text:
RSpec.describe Hyrax::CustomQueries::Navigators::FindFiles, valkyrie_adapter: :test_adapter do
  subject(:query_handler) do
    described_class.new(query_service: Hyrax.query_service)
  end

  describe '#find_files' do
    context 'when files exist' do
      let(:file_metadata1) { FactoryBot.valkyrie_create(:hyrax_file_metadata) }
      let(:file_metadata2) { FactoryBot.valkyrie_create(:hyrax_file_metadata) }
      let(:fileset) { FactoryBot.valkyrie_create(:hyrax_file_set, files: [file_metadata1, file_metadata2]) }

      it 'returns file metadata resource' do
        expect(query_handler.find_files(file_set: fileset).map(&:id).map(&:to_s))
          .to match_array [file_metadata1.id.to_s, file_metadata2.id.to_s]
      end
    end

    context 'when files do not exist' do
      let(:fileset) { FactoryBot.build(:hyrax_file_set) }

      it 'returns an empty array' do
        expect(query_handler.find_files(file_set: fileset)).to be_empty
      end
    end
  end

  describe '#find_original_file' do
    context 'when original file exists' do
      let(:original_file) { FactoryBot.valkyrie_create(:hyrax_file_metadata, use: :original_file) }
      let(:fileset) { FactoryBot.valkyrie_create(:hyrax_file_set, files: [original_file]) }

      it 'returns file metadata resource' do
        expect(query_handler.find_original_file(file_set: fileset).id.to_s).to eq original_file.id.to_s
      end
    end

    context 'when files do not exist' do
      let(:fileset) { FactoryBot.build(:hyrax_file_set) }

      it 'raises error' do
        expect { query_handler.find_original_file(file_set: fileset) }
          .to raise_error ::Valkyrie::Persistence::ObjectNotFoundError
      end
    end

    context 'when resource does not respond file_ids' do
      let(:fileset) { FactoryBot.build(:hyrax_resource) }

      it 'raises error' do
        expect { query_handler.find_original_file(file_set: fileset) }
          .to raise_error ::Valkyrie::Persistence::ObjectNotFoundError
      end
    end
  end

  describe '#find_extracted_text' do
    context 'when extracted text exists' do
      let(:fileset) { FactoryBot.valkyrie_create(:hyrax_file_set, files: [extracted_text]) }

      let(:extracted_text) do
        FactoryBot.valkyrie_create(:hyrax_file_metadata, use: :extracted_file)
      end

      it 'returns file metadata resource' do
        expect(query_handler.find_extracted_text(file_set: fileset).id.to_s).to eq extracted_text.id.to_s
      end
    end

    context 'when files do not exist' do
      let(:fileset) { FactoryBot.build(:hyrax_file_set) }

      it 'raises error' do
        expect { query_handler.find_extracted_text(file_set: fileset) }
          .to raise_error ::Valkyrie::Persistence::ObjectNotFoundError
      end
    end

    context 'when resource does not respond file_ids' do
      let(:fileset) { FactoryBot.build(:hyrax_resource) }

      it 'raises error' do
        expect { query_handler.find_extracted_text(file_set: fileset) }
          .to raise_error ::Valkyrie::Persistence::ObjectNotFoundError
      end
    end
  end

  describe '#find_thumbnail' do
    context 'when thumbnail exists' do
      let(:fileset) { FactoryBot.valkyrie_create(:hyrax_file_set, files: [thumbnail], thumbnail: thumbnail) }

      let(:thumbnail) do
        FactoryBot.valkyrie_create(:hyrax_file_metadata, use: :thumbnail_file)
      end

      it 'returns file metadata resource' do
        expect(query_handler.find_thumbnail(file_set: fileset).id.to_s).to eq thumbnail.id.to_s
      end
    end

    context 'when files do not exist' do
      let(:fileset) { FactoryBot.build(:hyrax_file_set) }

      it 'raises error' do
        expect { query_handler.find_thumbnail(file_set: fileset) }
          .to raise_error ::Valkyrie::Persistence::ObjectNotFoundError
      end
    end

    context 'when resource does not respond file_ids' do
      let(:fileset) { FactoryBot.build(:hyrax_resource) }

      it 'raises error' do
        expect { query_handler.find_thumbnail(file_set: fileset) }
          .to raise_error ::Valkyrie::Persistence::ObjectNotFoundError
      end
    end
  end
end


text:
gem 'omniauth-mojeid'

class mojeIDAuthenticator < ::Auth::OAuth2Authenticator

  CLIENT_ID = ''
  CLIENT_SECRET = ''

  def name
    'mojeid'
  end

  def register_middleware(omniauth)
    omniauth.provider :mojeid,
     CLIENT_ID,
     CLIENT_SECRET
  end
end

class OmniAuth::Strategies::mojeID < OmniAuth::Strategies::OAuth2
  # Give your strategy a name.
  option :name, "mojeid"

  # This is where you pass the options you would pass when
  # initializing your consumer from the OAuth gem.
  option :client_options, site: 'https://mojeid.fred.nic.cz/'

  # These are called after authentication has succeeded. If
  # possible, you should try to set the UID without making
  # additional calls (if the user id is returned with the token
  # or as a URI parameter). This may not be possible with all
  # providers.
  uid { raw_info['id'].to_s }

  info do
    {
      :name => raw_info['name'],
      :email => raw_info['email']
    }
  end

  extra do
    {
      'raw_info' => raw_info
    }
  end

  def raw_info
    @raw_info ||= access_token.get('/oidc/token/').parsed
  end
end

auth_provider :title => 'with mojeID Account',
    :message => 'Log in via mojeID Account (Make sure pop up blockers are not enabled).',
    :frame_width => 920,
    :frame_height => 800,
    :authenticator => mojeIDAuthenticator.new('mojeid', trusted: true, auto_create_account: true)

redpajama_set_name: RedPajamaGithub


text:
class CreateLessons < ActiveRecord::Migration
  def change
    create_table :lessons do |t|
      t.string :date
      t.string :scripture
      t.text :description

      t.timestamps null: false
    end
  end
end


text:
package android.prototype.trainer;

import java.util.HashMap;

//each point has the coordinate stored along with a map corresponding to RSSI values at that point
public class PointWithRSSI
{
	HashMap<String, AccessPoint> WeightedaccessPoints;		// the string is the ssid (unique for each access point)
	HashMap<String, Float> accessPoints;
	Point2D point;

	PointWithRSSI(String s) {
		if (s.equals("Weight")) {
			WeightedaccessPoints = new HashMap<String, AccessPoint> ();
		} else {
			accessPoints = new HashMap<String, Float> ();
		}
		point = null;
	}

	PointWithRSSI(AccessPoint ap) {
		WeightedaccessPoints = new HashMap<String, AccessPoint> ();
		WeightedaccessPoints.put(ap.getBssid(), ap);
		point = null;
	}

	PointWithRSSI(int x, int y, String s)
	{
		if (s.equals("Weight"))
		{
			WeightedaccessPoints = new HashMap<String, AccessPoint> ();
		} else {
			accessPoints = new HashMap<String, Float> ();
		}
		point = new Point2D(x,y);
	}

	PointWithRSSI(int x, int y, HashMap<String, AccessPoint> WeightedaccessPoints)
	{
		point = new Point2D(x,y);
		this.WeightedaccessPoints = WeightedaccessPoints;
	}

	PointWithRSSI(Point2D point, HashMap<String, Float> accessPoints)
	{
		this.point = point;
		this.accessPoints = accessPoints;
	}

	@Override public boolean equals (Object that)
	{
		if (this == that) return true;
		if (!(that instanceof PointWithRSSI)) return false;
		PointWithRSSI pr = (PointWithRSSI)that;
		if (pr.getPoint() == null) return false;
		return (pr.getPoint().equals(point));
	}

	public HashMap<String, Float> getAccessPoints() {
		return accessPoints;
	}

	public void setAccessPoints(HashMap<String, Float> accessPoints) {
		this.accessPoints = accessPoints;
	}

	public HashMap<String, AccessPoint> getWeightedaccessPoints() {
		return WeightedaccessPoints;
	}

	public void setWeightedaccessPoints(
			HashMap<String, AccessPoint> weightedaccessPoints) {
		WeightedaccessPoints = weightedaccessPoints;
	}

	public Point2D getPoint() {
		return point;
	}

	public void setPoint(Point2D point) {
		this.point = point;
	}

	public static class Point2D {
		private int x;
		private int y;

		Point2D(int x, int y) {
			this.x = x;
			this.y = y;
		}

		@Override public boolean equals (Object that)
		{
			if (this == that) return true;
			if (!(that instanceof Point2D)) return false;
			Point2D p = (Point2D)that;
			return (p.getX() == x && p.getY() == y);
		}

		@Override public String toString() {
			return ("("+x+","+y+")");
		}

		public int getX() {
			return x;
		}

		public void setX(int x) {
			this.x = x;
		}

		public int getY() {
			return y;
		}

		public void setY(int y) {
			this.y = y;
		}

	}
}


text:
<?xml version="1.0" encoding="UTF-8"?>
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/8.5/phpunit.xsd"
         bootstrap="vendor/autoload.php"
         executionOrder="depends,defects"
         forceCoversAnnotation="true"
         beStrictAboutCoversAnnotation="true"
         beStrictAboutOutputDuringTests="true"
         beStrictAboutTodoAnnotatedTests="true"
         colors="true"
         verbose="true">
    <testsuites>
        <testsuite name="default">
            <directory suffix="Test.php">tests</directory>
        </testsuite>
    </testsuites>

    <filter>
        <whitelist processUncoveredFilesFromWhitelist="true">
            <directory suffix=".php">src</directory>
        </whitelist>
    </filter>
</phpunit>


text:
class ofApp : public ofBaseApp {
public:
	void setup();
	void update();
	void draw();
	bool movePoint(vector<ofVec2f>& points, ofVec2f point);
	void mousePressed(int x, int y, int button);
	void mouseDragged(int x, int y, int button);
	void mouseReleased(int x, int y, int button);
	void keyPressed(int key);

	ofImage left, right, warpedColor;
	vector<ofVec2f> leftPoints, rightPoints;
	bool movingPoint;
	ofVec2f* curPoint;
	bool saveMatrix;
	bool homographyReady;

	cv::Mat homography;
};


text:
class PAGE_RES;
class PAGE_RES_IT;
class BLOCK_LIST;
class CharSamp;
class TO_BLOCK_LIST;
class IMAGE;
class WERD_RES;
class ROW;
class TBOX;
class SVMenuNode;
struct Pix;
class WERD_CHOICE;
class WERD;
class BLOB_CHOICE_LIST_CLIST;
struct OSResults;

// Top-level class for all tesseract global instance data.
// This class either holds or points to all data used by an instance
// of Tesseract, including the memory allocator. When this is
// complete, Tesseract will be thread-safe. UNTIL THEN, IT IS NOT!
//
// NOTE to developers: Do not create cyclic dependencies through this class!
// The directory dependency tree must remain a tree! The keep this clean,
// lower-level code (eg in ccutil, the bottom level) must never need to
// know about the content of a higher-level directory.
// The following scheme will grant the easiest access to lower-level
// global members without creating a cyclic dependency:
//
// Class Hierarchy (^ = inheritance):
//
//             CCUtil (ccutil/ccutil.h)
//                         ^      Members include: UNICHARSET
//            CUtil (cutil/cutil_class.h)
//                         ^       Members include: TBLOB*, TEXTBLOCK*
//           CCStruct (ccstruct/ccstruct.h)
//                         ^       Members include: Image
//           Classify (classify/classify.h)
//                         ^       Members include: Dict
//             WordRec (wordrec/wordrec.h)
//                         ^       Members include: WERD*, DENORM*
//        Tesseract (ccmain/tesseractclass.h)
//                                 Members include: Pix*, CubeRecoContext*,
//                                 TesseractCubeCombiner*
//
// Other important classes:
//
//  TessBaseAPI (api/baseapi.h)
//                                 Members include: BLOCK_LIST*, PAGE_RES*,
//                                 Tesseract*, ImageThresholder*
//  Dict (dict/dict.h)
//                                 Members include: Image* (private)
//
// NOTE: that each level contains members that correspond to global
// data that is defined (and used) at that level, not necessarily where
// the type is defined so for instance:
// BOOL_VAR_H(textord_show_blobs, false, "Display unsorted blobs");
// goes inside the Textord class, not the cc_util class.

namespace tesseract {

class ColumnFinder;
class CubeLineObject;
class CubeObject;
class CubeRecoContext;
class EquationDetect;
class Tesseract;
class TesseractCubeCombiner;

typedef void (Tesseract::*WordRecognizer)(BLOCK* block,
                                          ROW *row,
                                          WERD_RES *word);

// A collection of various variables for statistics and debugging.
struct TesseractStats {
  TesseractStats()
    : adaption_word_number(0),
      doc_blob_quality(0),
      doc_outline_errs(0),
      doc_char_quality(0),
      good_char_count(0),
      doc_good_char_quality(0),
      word_count(0),
      dict_words(0),
      tilde_crunch_written(false),
      last_char_was_newline(true),
      last_char_was_tilde(false),
      write_results_empty_block(true) {}

  inT32 adaption_word_number;
  inT16 doc_blob_quality;
  inT16 doc_outline_errs;
  inT16 doc_char_quality;
  inT16 good_char_count;
  inT16 doc_good_char_quality;
  inT32 word_count;  // count of word in the document
  inT32 dict_words;  // number of dicitionary words in the document
  STRING dump_words_str;  // accumulator used by dump_words()
  // Flags used by write_results()
  bool tilde_crunch_written;
  bool last_char_was_newline;
  bool last_char_was_tilde;
  bool write_results_empty_block;
};

class Tesseract : public Wordrec {
 public:
  Tesseract();
  ~Tesseract();

  // Clear as much used memory as possible without resetting the adaptive
  // classifier or losing any other classifier data.
  void Clear();
  // Clear all memory of adaption for this and all subclassifiers.
  void ResetAdaptiveClassifier();
  // Clear the document dictionary for this and all subclassifiers.
  void ResetDocumentDictionary();

  // Set the equation detector.
  void SetEquationDetect(EquationDetect* detector);

  // Simple accessors.
  const FCOORD& reskew() const {
    return reskew_;
  }
  // Destroy any existing pix and return a pointer to the pointer.
  Pix** mutable_pix_binary() {
    Clear();
    return &pix_binary_;
  }
  Pix* pix_binary() const {
    return pix_binary_;
  }
  Pix* pix_grey() const {
    return pix_grey_;
  }
  void set_pix_grey(Pix* grey_pix) {
    pixDestroy(&pix_grey_);
    pix_grey_ = grey_pix;
  }
  // Returns a pointer to a Pix representing the best available image of the
  // page. The image will be 8-bit grey if the input was grey or color. Note
  // that in grey 0 is black and 255 is white. If the input was binary, then
  // the returned Pix will be binary. Note that here black is 1 and white is 0.
  // To tell the difference pixGetDepth() will return 8 or 1.
  // In either case, the return value is a borrowed Pix, and should not be
  // deleted or pixDestroyed.
  Pix* BestPix() const {
    return pix_grey_ != NULL ? pix_grey_ : pix_binary_;
  }
  int source_resolution() const {
    return source_resolution_;
  }
  void set_source_resolution(int ppi) {
    source_resolution_ = ppi;
  }
  int ImageWidth() const {
    return pixGetWidth(pix_binary_);
  }
  int ImageHeight() const {
    return pixGetHeight(pix_binary_);
  }
  Pix* scaled_color() const {
    return scaled_color_;
  }
  int scaled_factor() const {
    return scaled_factor_;
  }
  void SetScaledColor(int factor, Pix* color) {
    scaled_factor_ = factor;
    scaled_color_ = color;
  }
  const Textord& textord() const {
    return textord_;
  }
  Textord* mutable_textord() {
    return &textord_;
  }

  bool right_to_left() const {
    return right_to_left_;
  }
  int num_sub_langs() const {
    return sub_langs_.size();
  }
  Tesseract* get_sub_lang(int index) const {
    return sub_langs_[index];
  }

  void SetBlackAndWhitelist();

  // Perform steps to prepare underlying binary image/other data structures for
  // page segmentation. Uses the strategy specified in the global variable
  // pageseg_devanagari_split_strategy for perform splitting while preparing for
  // page segmentation.
  void PrepareForPageseg();

  // Perform steps to prepare underlying binary image/other data structures for
  // Tesseract OCR. The current segmentation is required by this method.
  // Uses the strategy specified in the global variable
  // ocr_devanagari_split_strategy for performing splitting while preparing for
  // Tesseract ocr.
  void PrepareForTessOCR(BLOCK_LIST* block_list,
                         Tesseract* osd_tess, OSResults* osr);

  int SegmentPage(const STRING* input_file, BLOCK_LIST* blocks,
                  Tesseract* osd_tess, OSResults* osr);
  void SetupWordScripts(BLOCK_LIST* blocks);
  int AutoPageSeg(PageSegMode pageseg_mode,
                  BLOCK_LIST* blocks, TO_BLOCK_LIST* to_blocks,
                  Tesseract* osd_tess, OSResults* osr);
  ColumnFinder* SetupPageSegAndDetectOrientation(
      bool single_column, bool osd, bool only_osd,
      BLOCK_LIST* blocks, Tesseract* osd_tess, OSResults* osr,
      TO_BLOCK_LIST* to_blocks, Pix** photo_mask_pix, Pix** music_mask_pix);

  //// control.h /////////////////////////////////////////////////////////
  bool ProcessTargetWord(const TBOX& word_box, const TBOX& target_word_box,
                         const char* word_config, int pass);
  bool recog_all_words(PAGE_RES* page_res,
                       ETEXT_DESC* monitor,
                       const TBOX* target_word_box,
                       const char* word_config,
                       int dopasses);
  void rejection_passes(PAGE_RES* page_res,
                        ETEXT_DESC* monitor,
                        const TBOX* target_word_box,
                        const char* word_config);
  void bigram_correction_pass(PAGE_RES *page_res);
  void blamer_pass(PAGE_RES* page_res);
  // Helper to recognize the word using the given (language-specific) tesseract.
  // Returns true if the result was better than previously.
  bool RetryWithLanguage(WERD_RES *word, BLOCK* block, ROW *row,
                         WordRecognizer recognizer);
  void classify_word_and_language(WordRecognizer recognizer,
                                  BLOCK* block, ROW *row, WERD_RES *word);
  void classify_word_pass1(BLOCK* block, ROW *row, WERD_RES *word);
  void recog_pseudo_word(PAGE_RES* page_res,  // blocks to check
                         TBOX &selection_box);

  void fix_rep_char(PAGE_RES_IT* page_res_it);
  void ExplodeRepeatedWord(BLOB_CHOICE* best_choice, PAGE_RES_IT* page_res_it);

  ACCEPTABLE_WERD_TYPE acceptable_word_string(const UNICHARSET& char_set,
                                              const char *s,
                                              const char *lengths);
  void match_word_pass2(                 //recog one word
                        WERD_RES *word,  //word to do
                        ROW *row,
                        BLOCK* block);
  void classify_word_pass2(BLOCK* block, ROW *row, WERD_RES *word);
  void ReportXhtFixResult(bool accept_new_word, float new_x_ht,
                          WERD_RES* word, WERD_RES* new_word);
  bool RunOldFixXht(WERD_RES *word, BLOCK* block, ROW *row);
  bool TrainedXheightFix(WERD_RES *word, BLOCK* block, ROW *row);
  BOOL8 recog_interactive(BLOCK* block, ROW* row, WERD_RES* word_res);

  void set_word_fonts(
      WERD_RES *word,  // set fonts of this word
      BLOB_CHOICE_LIST_CLIST *blob_choices);  // detailed results
  void font_recognition_pass(PAGE_RES* page_res);
  BOOL8 check_debug_pt(WERD_RES *word, int location);

  //// cube_control.cpp ///////////////////////////////////////////////////
  bool init_cube_objects(bool load_combiner,
                         TessdataManager *tessdata_manager);
  // Iterates through tesseract's results and calls cube on each word,
  // combining the results with the existing tesseract result.
  void run_cube_combiner(PAGE_RES *page_res);
  // Recognizes a single word using (only) cube. Compatible with
  // Tesseract's classify_word_pass1/classify_word_pass2.
  void cube_word_pass1(BLOCK* block, ROW *row, WERD_RES *word);
  // Cube recognizer to recognize a single word as with classify_word_pass1
  // but also returns the cube object in case the combiner is needed.
  CubeObject* cube_recognize_word(BLOCK* block, WERD_RES* word);
  // Combines the cube and tesseract results for a single word, leaving the
  // result in tess_word.
  void cube_combine_word(CubeObject* cube_obj, WERD_RES* cube_word,
                        WERD_RES* tess_word);
  // Call cube on the current word, and write the result to word.
  // Sets up a fake result  and returns false if something goes wrong.
  bool cube_recognize(CubeObject *cube_obj, BLOCK* block, WERD_RES *word);
  void fill_werd_res(const BoxWord& cube_box_word,
                     WERD_CHOICE* cube_werd_choice,
                     const char* cube_best_str,
                     WERD_RES* tess_werd_res);
  bool extract_cube_state(CubeObject* cube_obj, int* num_chars,
                          Boxa** char_boxes, CharSamp*** char_samples);
  bool create_cube_box_word(Boxa *char_boxes, int num_chars,
                            TBOX word_box, BoxWord* box_word);
  //// output.h //////////////////////////////////////////////////////////

  void output_pass(PAGE_RES_IT &page_res_it, const TBOX *target_word_box);
  void write_results(PAGE_RES_IT &page_res_it,  // full info
                     char newline_type,         // type of newline
                     BOOL8 force_eol            // override tilde crunch?
                    );
  void set_unlv_suspects(WERD_RES *word);
  UNICHAR_ID get_rep_char(WERD_RES *word);  // what char is repeated?
  BOOL8 acceptable_number_string(const char *s,
                                 const char *lengths);
  inT16 count_alphanums(const WERD_CHOICE &word);
  inT16 count_alphas(const WERD_CHOICE &word);
  //// tessedit.h ////////////////////////////////////////////////////////
  void read_config_file(const char *filename, SetParamConstraint constraint);
  // Initialize for potentially a set of languages defined by the language
  // string and recursively any additional languages required by any language
  // traineddata file (via tessedit_load_sublangs in its config) that is loaded.
  // See init_tesseract_internal for args.
  int init_tesseract(const char *arg0,
                     const char *textbase,
                     const char *language,
                     OcrEngineMode oem,
                     char **configs,
                     int configs_size,
                     const GenericVector<STRING> *vars_vec,
                     const GenericVector<STRING> *vars_values,
                     bool set_only_init_params);
  int init_tesseract(const char *datapath,
                     const char *language,
                     OcrEngineMode oem) {
    return init_tesseract(datapath, NULL, language, oem,
                          NULL, 0, NULL, NULL, false);
  }
  // Common initialization for a single language.
  // arg0 is the datapath for the tessdata directory, which could be the
  // path of the tessdata directory with no trailing /, or (if tessdata
  // lives in the same directory as the executable, the path of the executable,
  // hence the name arg0.
  // textbase is an optional output file basename (used only for training)
  // language is the language code to load.
  // oem controls which engine(s) will operate on the image
  // configs (argv) is an array of config filenames to load variables from.
  // May be NULL.
  // configs_size (argc) is the number of elements in configs.
  // vars_vec is an optional vector of variables to set.
  // vars_values is an optional corresponding vector of values for the variables
  // in vars_vec.
  // If set_only_init_params is true, then only the initialization variables
  // will be set.
  int init_tesseract_internal(const char *arg0,
                              const char *textbase,
                              const char *language,
                              OcrEngineMode oem,
                              char **configs,
                              int configs_size,
                              const GenericVector<STRING> *vars_vec,
                              const GenericVector<STRING> *vars_values,
                              bool set_only_init_params);

  // Set the universal_id member of each font to be unique among all
  // instances of the same font loaded.
  void SetupUniversalFontIds();

  int init_tesseract_lm(const char *arg0,
                        const char *textbase,
                        const char *language);

  void recognize_page(STRING& image_name);
  void end_tesseract();

  bool init_tesseract_lang_data(const char *arg0,
                                const char *textbase,
                                const char *language,
                                OcrEngineMode oem,
                                char **configs,
                                int configs_size,
                                const GenericVector<STRING> *vars_vec,
                                const GenericVector<STRING> *vars_values,
                                bool set_only_init_params);

  void ParseLanguageString(const char* lang_str,
                           GenericVector<STRING>* to_load,
                           GenericVector<STRING>* not_to_load);

  //// pgedit.h //////////////////////////////////////////////////////////
  SVMenuNode *build_menu_new();
  #ifndef GRAPHICS_DISABLED
  void pgeditor_main(int width, int height, PAGE_RES* page_res);
  #endif  // GRAPHICS_DISABLED
  void process_image_event( // action in image win
                           const SVEvent &event);
  BOOL8 process_cmd_win_event(                 // UI command semantics
                              inT32 cmd_event,  // which menu item?
                              char *new_value   // any prompt data
                             );
  void debug_word(PAGE_RES* page_res, const TBOX &selection_box);
  void do_re_display(
      BOOL8 (tesseract::Tesseract::*word_painter)(BLOCK* block,
                                                  ROW* row,
                                                  WERD_RES* word_res));
  BOOL8 word_display(BLOCK* block, ROW* row, WERD_RES* word_res);
  BOOL8 word_bln_display(BLOCK* block, ROW* row, WERD_RES* word_res);
  BOOL8 word_blank_and_set_display(BLOCK* block, ROW* row, WERD_RES* word_res);
  BOOL8 word_set_display(BLOCK* block, ROW* row, WERD_RES* word_res);
  // #ifndef GRAPHICS_DISABLED
  BOOL8 word_dumper(BLOCK* block, ROW* row, WERD_RES* word_res);
  // #endif  // GRAPHICS_DISABLED
  //// reject.h //////////////////////////////////////////////////////////
  void make_reject_map(            //make rej map for wd //detailed results
                       WERD_RES *word,
                       BLOB_CHOICE_LIST_CLIST *blob_choices,
                       ROW *row,
                       inT16 pass  //1st or 2nd?
                      );
  BOOL8 one_ell_conflict(WERD_RES *word_res, BOOL8 update_map);
  inT16 first_alphanum_index(const char *word,
                             const char *word_lengths);
  inT16 first_alphanum_offset(const char *word,
                              const char *word_lengths);
  inT16 alpha_count(const char *word,
                    const char *word_lengths);
  BOOL8 word_contains_non_1_digit(const char *word,
                                  const char *word_lengths);
  void dont_allow_1Il(WERD_RES *word);
  inT16 count_alphanums(  //how many alphanums
                        WERD_RES *word);
  void flip_0O(WERD_RES *word);
  BOOL8 non_0_digit(const UNICHARSET& ch_set, UNICHAR_ID unichar_id);
  BOOL8 non_O_upper(const UNICHARSET& ch_set, UNICHAR_ID unichar_id);
  BOOL8 repeated_nonalphanum_wd(WERD_RES *word, ROW *row);
  void nn_match_word(  //Match a word
                     WERD_RES *word,
                     ROW *row);
  void nn_recover_rejects(WERD_RES *word, ROW *row);
  BOOL8 test_ambig_word(  //test for ambiguity
                        WERD_RES *word);
  void set_done(  //set done flag
                WERD_RES *word,
                inT16 pass);
  inT16 safe_dict_word(const WERD_RES *werd_res);  // is best_choice in dict?
  void flip_hyphens(WERD_RES *word);
  void reject_I_1_L(WERD_RES *word);
  void reject_edge_blobs(WERD_RES *word);
  void reject_mostly_rejects(WERD_RES *word);
  //// adaptions.h ///////////////////////////////////////////////////////
  BOOL8 word_adaptable(  //should we adapt?
                       WERD_RES *word,
                       uinT16 mode);

  //// tfacepp.cpp ///////////////////////////////////////////////////////
  void recog_word_recursive(WERD_RES* word,
                            BLOB_CHOICE_LIST_CLIST *blob_choices);
  void recog_word(WERD_RES *word,
                  BLOB_CHOICE_LIST_CLIST *blob_choices);
  void split_and_recog_word(WERD_RES* word,
                            BLOB_CHOICE_LIST_CLIST *blob_choices);
  //// fixspace.cpp ///////////////////////////////////////////////////////
  BOOL8 digit_or_numeric_punct(WERD_RES *word, int char_position);
  inT16 eval_word_spacing(WERD_RES_LIST &word_res_list);
  void match_current_words(WERD_RES_LIST &words, ROW *row, BLOCK* block);
  inT16 fp_eval_word_spacing(WERD_RES_LIST &word_res_list);
  void fix_noisy_space_list(WERD_RES_LIST &best_perm, ROW *row, BLOCK* block);
  void fix_fuzzy_space_list(  //space explorer
                            WERD_RES_LIST &best_perm,
                            ROW *row,
                            BLOCK* block);
  void fix_sp_fp_word(WERD_RES_IT &word_res_it, ROW *row, BLOCK* block);
  void fix_fuzzy_spaces(                      //find fuzzy words
                        ETEXT_DESC *monitor,  //progress monitor
                        inT32 word_count,     //count of words in doc
                        PAGE_RES *page_res);
  void dump_words(WERD_RES_LIST &perm, inT16 score,
                  inT16 mode, BOOL8 improved);
  BOOL8 uniformly_spaced(WERD_RES *word);
  BOOL8 fixspace_thinks_word_done(WERD_RES *word);
  inT16 worst_noise_blob(WERD_RES *word_res, float *worst_noise_score);
  float blob_noise_score(TBLOB *blob);
  void break_noisiest_blob_word(WERD_RES_LIST &words);
  //// docqual.cpp ////////////////////////////////////////////////////////
  GARBAGE_LEVEL garbage_word(WERD_RES *word, BOOL8 ok_dict_word);
  BOOL8 potential_word_crunch(WERD_RES *word,
                              GARBAGE_LEVEL garbage_level,
                              BOOL8 ok_dict_word);
  void tilde_crunch(PAGE_RES_IT &page_res_it);
  void unrej_good_quality_words(  //unreject potential
                                PAGE_RES_IT &page_res_it);
  void doc_and_block_rejection(  //reject big chunks
                               PAGE_RES_IT &page_res_it,
                               BOOL8 good_quality_doc);
  void quality_based_rejection(PAGE_RES_IT &page_res_it,
                               BOOL8 good_quality_doc);
  void convert_bad_unlv_chs(WERD_RES *word_res);
  void tilde_delete(PAGE_RES_IT &page_res_it);
  inT16 word_blob_quality(WERD_RES *word, ROW *row);
  void word_char_quality(WERD_RES *word, ROW *row, inT16 *match_count,
                         inT16 *accepted_match_count);
  void unrej_good_chs(WERD_RES *word, ROW *row);
  inT16 count_outline_errs(char c, inT16 outline_count);
  inT16 word_outline_errs(WERD_RES *word);
  BOOL8 terrible_word_crunch(WERD_RES *word, GARBAGE_LEVEL garbage_level);
  CRUNCH_MODE word_deletable(WERD_RES *word, inT16 &delete_mode);
  inT16 failure_count(WERD_RES *word);
  BOOL8 noise_outlines(TWERD *word);
  //// pagewalk.cpp ///////////////////////////////////////////////////////
  void
  process_selected_words (
      PAGE_RES* page_res, // blocks to check
      //function to call
      TBOX & selection_box,
      BOOL8 (tesseract::Tesseract::*word_processor) (BLOCK* block,
                                                     ROW* row,
                                                     WERD_RES* word_res));
  //// tessbox.cpp ///////////////////////////////////////////////////////
  void tess_add_doc_word(                          //test acceptability
                         WERD_CHOICE *word_choice  //after context
                        );
  void tess_segment_pass1(WERD_RES *word,
                          BLOB_CHOICE_LIST_CLIST *blob_choices);
  void tess_segment_pass2(WERD_RES *word,
                          BLOB_CHOICE_LIST_CLIST *blob_choices);
  BOOL8 tess_acceptable_word(                           //test acceptability
                             WERD_CHOICE *word_choice,  //after context
                             WERD_CHOICE *raw_choice    //before context
                            );
  //// applybox.cpp //////////////////////////////////////////////////////
  // Applies the box file based on the image name fname, and resegments
  // the words in the block_list (page), with:
  // blob-mode: one blob per line in the box file, words as input.
  // word/line-mode: one blob per space-delimited unit after the #, and one word
  // per line in the box file. (See comment above for box file format.)
  // If find_segmentation is true, (word/line mode) then the classifier is used
  // to re-segment words/lines to match the space-delimited truth string for
  // each box. In this case, the input box may be for a word or even a whole
  // text line, and the output words will contain multiple blobs corresponding
  // to the space-delimited input string.
  // With find_segmentation false, no classifier is needed, but the chopper
  // can still be used to correctly segment touching characters with the help
  // of the input boxes.
  // In the returned PAGE_RES, the WERD_RES are setup as they would be returned
  // from normal classification, ie. with a word, chopped_word, rebuild_word,
  // seam_array, denorm, box_word, and best_state, but NO best_choice or
  // raw_choice, as they would require a UNICHARSET, which we aim to avoid.
  // Instead, the correct_text member of WERD_RES is set, and this may be later
  // converted to a best_choice using CorrectClassifyWords. CorrectClassifyWords
  // is not required before calling ApplyBoxTraining.
  PAGE_RES* ApplyBoxes(const STRING& fname, bool find_segmentation,
                       BLOCK_LIST *block_list);

  // Builds a PAGE_RES from the block_list in the way required for ApplyBoxes:
  // All fuzzy spaces are removed, and all the words are maximally chopped.
  PAGE_RES* SetupApplyBoxes(const GenericVector<TBOX>& boxes,
                            BLOCK_LIST *block_list);
  // Tests the chopper by exhaustively running chop_one_blob.
  // The word_res will contain filled chopped_word, seam_array, denorm,
  // box_word and best_state for the maximally chopped word.
  void MaximallyChopWord(const GenericVector<TBOX>& boxes,
                         BLOCK* block, ROW* row, WERD_RES* word_res);
  // Gather consecutive blobs that match the given box into the best_state
  // and corresponding correct_text.
  // Fights over which box owns which blobs are settled by pre-chopping and
  // applying the blobs to box or next_box with the least non-overlap.
  // Returns false if the box was in error, which can only be caused by
  // failing to find an appropriate blob for a box.
  // This means that occasionally, blobs may be incorrectly segmented if the
  // chopper fails to find a suitable chop point.
  bool ResegmentCharBox(PAGE_RES* page_res, const TBOX *prev_box,
                        const TBOX& box, const TBOX& next_box,
                        const char* correct_text);
  // Consume all source blobs that strongly overlap the given box,
  // putting them into a new word, with the correct_text label.
  // Fights over which box owns which blobs are settled by
  // applying the blobs to box or next_box with the least non-overlap.
  // Returns false if the box was in error, which can only be caused by
  // failing to find an overlapping blob for a box.
  bool ResegmentWordBox(BLOCK_LIST *block_list,
                        const TBOX& box, const TBOX& next_box,
                        const char* correct_text);
  // Resegments the words by running the classifier in an attempt to find the
  // correct segmentation that produces the required string.
  void ReSegmentByClassification(PAGE_RES* page_res);
  // Converts the space-delimited string of utf8 text to a vector of UNICHAR_ID.
  // Returns false if an invalid UNICHAR_ID is encountered.
  bool ConvertStringToUnichars(const char* utf8,
                               GenericVector<UNICHAR_ID>* class_ids);
  // Resegments the word to achieve the target_text from the classifier.
  // Returns false if the re-segmentation fails.
  // Uses brute-force combination of upto kMaxGroupSize adjacent blobs, and
  // applies a full search on the classifier results to find the best classified
  // segmentation. As a compromise to obtain better recall, 1-1 ambigiguity
  // substitutions ARE used.
  bool FindSegmentation(const GenericVector<UNICHAR_ID>& target_text,
                        WERD_RES* word_res);
  // Recursive helper to find a match to the target_text (from text_index
  // position) in the choices (from choices_pos position).
  // Choices is an array of GenericVectors, of length choices_length, with each
  // element representing a starting position in the word, and the
  // GenericVector holding classification results for a sequence of consecutive
  // blobs, with index 0 being a single blob, index 1 being 2 blobs etc.
  void SearchForText(const GenericVector<BLOB_CHOICE_LIST*>* choices,
                     int choices_pos, int choices_length,
                     const GenericVector<UNICHAR_ID>& target_text,
                     int text_index,
                     float rating, GenericVector<int>* segmentation,
                     float* best_rating, GenericVector<int>* best_segmentation);
  // Counts up the labelled words and the blobs within.
  // Deletes all unused or emptied words, counting the unused ones.
  // Resets W_BOL and W_EOL flags correctly.
  // Builds the rebuild_word and rebuilds the box_word.
  void TidyUp(PAGE_RES* page_res);
  // Logs a bad box by line in the box file and box coords.
  void ReportFailedBox(int boxfile_lineno, TBOX box, const char *box_ch,
                       const char *err_msg);
  // Creates a fake best_choice entry in each WERD_RES with the correct text.
  void CorrectClassifyWords(PAGE_RES* page_res);
  // Call LearnWord to extract features for labelled blobs within each word.
  // Features are written to the given filename.
  void ApplyBoxTraining(const STRING& filename, PAGE_RES* page_res);

  //// fixxht.cpp ///////////////////////////////////////////////////////
  // Returns the number of misfit blob tops in this word.
  int CountMisfitTops(WERD_RES *word_res);
  // Returns a new x-height in pixels (original image coords) that is
  // maximally compatible with the result in word_res.
  // Returns 0.0f if no x-height is found that is better than the current
  // estimate.
  float ComputeCompatibleXheight(WERD_RES *word_res);
  //// Data members ///////////////////////////////////////////////////////
  // TODO(ocr-team): Remove obsolete parameters.
  BOOL_VAR_H(tessedit_resegment_from_boxes, false,
             "Take segmentation and labeling from box file");
  BOOL_VAR_H(tessedit_resegment_from_line_boxes, false,
              "Conversion of word/line box file to char box file");
  BOOL_VAR_H(tessedit_train_from_boxes, false,
             "Generate training data from boxed chars");
  BOOL_VAR_H(tessedit_make_boxes_from_boxes, false,
             "Generate more boxes from boxed chars");
  BOOL_VAR_H(tessedit_dump_pageseg_images, false,
             "Dump intermediate images made during page segmentation");
  INT_VAR_H(tessedit_pageseg_mode, PSM_SINGLE_BLOCK,
            "Page seg mode: 0=osd only, 1=auto+osd, 2=auto, 3=col, 4=block,"
            " 5=line, 6=word, 7=char"
            " (Values from PageSegMode enum in publictypes.h)");
  INT_VAR_H(tessedit_ocr_engine_mode, tesseract::OEM_TESSERACT_ONLY,
            "Which OCR engine(s) to run (Tesseract, Cube, both). Defaults"
            " to loading and running only Tesseract (no Cube, no combiner)."
            " (Values from OcrEngineMode enum in tesseractclass.h)");
  STRING_VAR_H(tessedit_char_blacklist, "",
               "Blacklist of chars not to recognize");
  STRING_VAR_H(tessedit_char_whitelist, "",
               "Whitelist of chars to recognize");
  BOOL_VAR_H(tessedit_ambigs_training, false,
             "Perform training for ambiguities");
  INT_VAR_H(pageseg_devanagari_split_strategy,
            tesseract::ShiroRekhaSplitter::NO_SPLIT,
            "Whether to use the top-line splitting process for Devanagari "
            "documents while performing page-segmentation.");
  INT_VAR_H(ocr_devanagari_split_strategy,
            tesseract::ShiroRekhaSplitter::NO_SPLIT,
            "Whether to use the top-line splitting process for Devanagari "
            "documents while performing ocr.");
  STRING_VAR_H(tessedit_write_params_to_file, "",
               "Write all parameters to the given file.");
  BOOL_VAR_H(tessedit_adapt_to_char_fragments, true,
             "Adapt to words that contain "
             " a character composed form fragments");
  BOOL_VAR_H(tessedit_adaption_debug, false,
             "Generate and print debug information for adaption");
  INT_VAR_H(bidi_debug, 0, "Debug level for BiDi");
  INT_VAR_H(applybox_debug, 1, "Debug level");
  INT_VAR_H(applybox_page, 0, "Page number to apply boxes from");
  STRING_VAR_H(applybox_exposure_pattern, ".exp",
               "Exposure value follows this pattern in the image"
               " filename. The name of the image files are expected"
               " to be in the form [lang].[fontname].exp[num].tif");
  BOOL_VAR_H(applybox_learn_chars_and_char_frags_mode, false,
             "Learn both character fragments (as is done in the"
             " special low exposure mode) as well as unfragmented"
             " characters.");
  BOOL_VAR_H(applybox_learn_ngrams_mode, false,
             "Each bounding box is assumed to contain ngrams. Only"
             " learn the ngrams whose outlines overlap horizontally.");
  BOOL_VAR_H(tessedit_display_outwords, false, "Draw output words");
  BOOL_VAR_H(tessedit_training_tess, false, "Call Tess to learn blobs");
  BOOL_VAR_H(tessedit_dump_choices, false, "Dump char choices");
  BOOL_VAR_H(tessedit_fix_fuzzy_spaces, true,
             "Try to improve fuzzy spaces");
  BOOL_VAR_H(tessedit_unrej_any_wd, false,
             "Dont bother with word plausibility");
  BOOL_VAR_H(tessedit_fix_hyphens, true, "Crunch double hyphens?");
  BOOL_VAR_H(tessedit_redo_xheight, true, "Check/Correct x-height");
  BOOL_VAR_H(tessedit_enable_doc_dict, true,
             "Add words to the document dictionary");
  BOOL_VAR_H(tessedit_debug_fonts, false, "Output font info per char");
  BOOL_VAR_H(tessedit_debug_block_rejection, false, "Block and Row stats");
  BOOL_VAR_H(tessedit_enable_bigram_correction, false,
             "Enable correction based on the word bigram dictionary.");
  INT_VAR_H(tessedit_bigram_debug, 0, "Amount of debug output for bigram "
            "correction.");
  INT_VAR_H(debug_x_ht_level, 0, "Reestimate debug");
  BOOL_VAR_H(debug_acceptable_wds, false, "Dump word pass/fail chk");
  STRING_VAR_H(chs_leading_punct, "('`\"", "Leading punctuation");
  STRING_VAR_H(chs_trailing_punct1, ").,;:?!", "1st Trailing punctuation");
  STRING_VAR_H(chs_trailing_punct2, ")'`\"", "2nd Trailing punctuation");
  double_VAR_H(quality_rej_pc, 0.08, "good_quality_doc lte rejection limit");
  double_VAR_H(quality_blob_pc, 0.0, "good_quality_doc gte good blobs limit");
  double_VAR_H(quality_outline_pc, 1.0,
               "good_quality_doc lte outline error limit");
  double_VAR_H(quality_char_pc, 0.95, "good_quality_doc gte good char limit");
  INT_VAR_H(quality_min_initial_alphas_reqd, 2, "alphas in a good word");
  BOOL_VAR_H(tessedit_tess_adapt_to_rejmap, false,
             "Use reject map to control Tesseract adaption");
  INT_VAR_H(tessedit_tess_adaption_mode, 0x27,
            "Adaptation decision algorithm for tess");
  BOOL_VAR_H(tessedit_minimal_rej_pass1, false,
             "Do minimal rejection on pass 1 output");
  BOOL_VAR_H(tessedit_test_adaption, false, "Test adaption criteria");
  BOOL_VAR_H(tessedit_matcher_log, false, "Log matcher activity");
  INT_VAR_H(tessedit_test_adaption_mode, 3,
            "Adaptation decision algorithm for tess");
  BOOL_VAR_H(save_blob_choices, false,
             "Save the results of the recognition step"
             " (blob_choices) within the corresponding WERD_CHOICE");
  BOOL_VAR_H(test_pt, false, "Test for point");
  double_VAR_H(test_pt_x, 99999.99, "xcoord");
  double_VAR_H(test_pt_y, 99999.99, "ycoord");
  INT_VAR_H(paragraph_debug_level, 0, "Print paragraph debug info.");
  INT_VAR_H(cube_debug_level, 1, "Print cube debug info.");
  STRING_VAR_H(outlines_odd, "%| ", "Non standard number of outlines");
  STRING_VAR_H(outlines_2, "ij!?%\":;", "Non standard number of outlines");
  BOOL_VAR_H(docqual_excuse_outline_errs, false,
             "Allow outline errs in unrejection?");
  BOOL_VAR_H(tessedit_good_quality_unrej, true,
             "Reduce rejection on good docs");
  BOOL_VAR_H(tessedit_use_reject_spaces, true, "Reject spaces?");
  double_VAR_H(tessedit_reject_doc_percent, 65.00,
               "%rej allowed before rej whole doc");
  double_VAR_H(tessedit_reject_block_percent, 45.00,
               "%rej allowed before rej whole block");
  double_VAR_H(tessedit_reject_row_percent, 40.00,
               "%rej allowed before rej whole row");
  double_VAR_H(tessedit_whole_wd_rej_row_percent, 70.00,
               "Number of row rejects in whole word rejects"
               "which prevents whole row rejection");
  BOOL_VAR_H(tessedit_preserve_blk_rej_perfect_wds, true,
             "Only rej partially rejected words in block rejection");
  BOOL_VAR_H(tessedit_preserve_row_rej_perfect_wds, true,
             "Only rej partially rejected words in row rejection");
  BOOL_VAR_H(tessedit_dont_blkrej_good_wds, false,
             "Use word segmentation quality metric");
  BOOL_VAR_H(tessedit_dont_rowrej_good_wds, false,
             "Use word segmentation quality metric");
  INT_VAR_H(tessedit_preserve_min_wd_len, 2,
            "Only preserve wds longer than this");
  BOOL_VAR_H(tessedit_row_rej_good_docs, true,
             "Apply row rejection to good docs");
  double_VAR_H(tessedit_good_doc_still_rowrej_wd, 1.1,
               "rej good doc wd if more than this fraction rejected");
  BOOL_VAR_H(tessedit_reject_bad_qual_wds, true,
             "Reject all bad quality wds");
  BOOL_VAR_H(tessedit_debug_doc_rejection, false, "Page stats");
  BOOL_VAR_H(tessedit_debug_quality_metrics, false,
             "Output data to debug file");
  BOOL_VAR_H(bland_unrej, false, "unrej potential with no chekcs");
  double_VAR_H(quality_rowrej_pc, 1.1,
               "good_quality_doc gte good char limit");
  BOOL_VAR_H(unlv_tilde_crunching, true,
             "Mark v.bad words for tilde crunch");
  BOOL_VAR_H(crunch_early_merge_tess_fails, true, "Before word crunch?");
  BOOL_VAR_H(crunch_early_convert_bad_unlv_chs, false, "Take out ~^ early?");
  double_VAR_H(crunch_terrible_rating, 80.0, "crunch rating lt this");
  BOOL_VAR_H(crunch_terrible_garbage, true, "As it says");
  double_VAR_H(crunch_poor_garbage_cert, -9.0,
               "crunch garbage cert lt this");
  double_VAR_H(crunch_poor_garbage_rate, 60, "crunch garbage rating lt this");
  double_VAR_H(crunch_pot_poor_rate, 40, "POTENTIAL crunch rating lt this");
  double_VAR_H(crunch_pot_poor_cert, -8.0, "POTENTIAL crunch cert lt this");
  BOOL_VAR_H(crunch_pot_garbage, true, "POTENTIAL crunch garbage");
  double_VAR_H(crunch_del_rating, 60, "POTENTIAL crunch rating lt this");
  double_VAR_H(crunch_del_cert, -10.0, "POTENTIAL crunch cert lt this");
  double_VAR_H(crunch_del_min_ht, 0.7, "Del if word ht lt xht x this");
  double_VAR_H(crunch_del_max_ht, 3.0, "Del if word ht gt xht x this");
  double_VAR_H(crunch_del_min_width, 3.0, "Del if word width lt xht x this");
  double_VAR_H(crunch_del_high_word, 1.5,
               "Del if word gt xht x this above bl");
  double_VAR_H(crunch_del_low_word, 0.5, "Del if word gt xht x this below bl");
  double_VAR_H(crunch_small_outlines_size, 0.6, "Small if lt xht x this");
  INT_VAR_H(crunch_rating_max, 10, "For adj length in rating per ch");
  INT_VAR_H(crunch_pot_indicators, 1, "How many potential indicators needed");
  BOOL_VAR_H(crunch_leave_ok_strings, true, "Dont touch sensible strings");
  BOOL_VAR_H(crunch_accept_ok, true, "Use acceptability in okstring");
  BOOL_VAR_H(crunch_leave_accept_strings, false,
             "Dont pot crunch sensible strings");
  BOOL_VAR_H(crunch_include_numerals, false, "Fiddle alpha figures");
  INT_VAR_H(crunch_leave_lc_strings, 4,
            "Dont crunch words with long lower case strings");
  INT_VAR_H(crunch_leave_uc_strings, 4,
            "Dont crunch words with long lower case strings");
  INT_VAR_H(crunch_long_repetitions, 3, "Crunch words with long repetitions");
  INT_VAR_H(crunch_debug, 0, "As it says");
  INT_VAR_H(fixsp_non_noise_limit, 1,
            "How many non-noise blbs either side?");
  double_VAR_H(fixsp_small_outlines_size, 0.28, "Small if lt xht x this");
  BOOL_VAR_H(tessedit_prefer_joined_punct, false, "Reward punctation joins");
  INT_VAR_H(fixsp_done_mode, 1, "What constitues done for spacing");
  INT_VAR_H(debug_fix_space_level, 0, "Contextual fixspace debug");
  STRING_VAR_H(numeric_punctuation, ".,",
               "Punct. chs expected WITHIN numbers");
  INT_VAR_H(x_ht_acceptance_tolerance, 8,
            "Max allowed deviation of blob top outside of font data");
  INT_VAR_H(x_ht_min_change, 8, "Min change in xht before actually trying it");
  BOOL_VAR_H(tessedit_write_block_separators, false,
             "Write block separators in output");
  BOOL_VAR_H(tessedit_write_rep_codes, false,
             "Write repetition char code");
  BOOL_VAR_H(tessedit_write_unlv, false, "Write .unlv output file");
  BOOL_VAR_H(tessedit_create_hocr, false, "Write .html hOCR output file");
  STRING_VAR_H(unrecognised_char, "|",
               "Output char for unidentified blobs");
  INT_VAR_H(suspect_level, 99, "Suspect marker level");
  INT_VAR_H(suspect_space_level, 100,
            "Min suspect level for rejecting spaces");
  INT_VAR_H(suspect_short_words, 2,
            "Dont Suspect dict wds longer than this");
  BOOL_VAR_H(suspect_constrain_1Il, false, "UNLV keep 1Il chars rejected");
  double_VAR_H(suspect_rating_per_ch, 999.9, "Dont touch bad rating limit");
  double_VAR_H(suspect_accept_rating, -999.9, "Accept good rating limit");
  BOOL_VAR_H(tessedit_minimal_rejection, false, "Only reject tess failures");
  BOOL_VAR_H(tessedit_zero_rejection, false, "Dont reject ANYTHING");
  BOOL_VAR_H(tessedit_word_for_word, false,
             "Make output have exactly one word per WERD");
  BOOL_VAR_H(tessedit_zero_kelvin_rejection, false,
             "Dont reject ANYTHING AT ALL");
  BOOL_VAR_H(tessedit_consistent_reps, true, "Force all rep chars the same");
  INT_VAR_H(tessedit_reject_mode, 0, "Rejection algorithm");
  INT_VAR_H(tessedit_ok_mode, 5, "Acceptance decision algorithm");
  BOOL_VAR_H(tessedit_rejection_debug, false, "Adaption debug");
  BOOL_VAR_H(tessedit_flip_0O, true, "Contextual 0O O0 flips");
  double_VAR_H(tessedit_lower_flip_hyphen, 1.5,
               "Aspect ratio dot/hyphen test");
  double_VAR_H(tessedit_upper_flip_hyphen, 1.8,
               "Aspect ratio dot/hyphen test");
  BOOL_VAR_H(rej_trust_doc_dawg, false, "Use DOC dawg in 11l conf. detector");
  BOOL_VAR_H(rej_1Il_use_dict_word, false, "Use dictword test");
  BOOL_VAR_H(rej_1Il_trust_permuter_type, true, "Dont double check");
  BOOL_VAR_H(rej_use_tess_accepted, true, "Individual rejection control");
  BOOL_VAR_H(rej_use_tess_blanks, true, "Individual rejection control");
  BOOL_VAR_H(rej_use_good_perm, true, "Individual rejection control");
  BOOL_VAR_H(rej_use_sensible_wd, false, "Extend permuter check");
  BOOL_VAR_H(rej_alphas_in_number_perm, false, "Extend permuter check");
  double_VAR_H(rej_whole_of_mostly_reject_word_fract, 0.85, "if >this fract");
  INT_VAR_H(tessedit_image_border, 2, "Rej blbs near image edge limit");
  STRING_VAR_H(ok_repeated_ch_non_alphanum_wds, "-?*\075",
               "Allow NN to unrej");
  STRING_VAR_H(conflict_set_I_l_1, "Il1[]", "Il1 conflict set");
  INT_VAR_H(min_sane_x_ht_pixels, 8, "Reject any x-ht lt or eq than this");
  BOOL_VAR_H(tessedit_create_boxfile, false, "Output text with boxes");
  INT_VAR_H(tessedit_page_number, -1,
            "-1 -> All pages, else specifc page to process");
  BOOL_VAR_H(tessedit_write_images, false, "Capture the image from the IPE");
  BOOL_VAR_H(interactive_display_mode, false, "Run interactively?");
  STRING_VAR_H(file_type, ".tif", "Filename extension");
  BOOL_VAR_H(tessedit_override_permuter, true, "According to dict_word");
  INT_VAR_H(tessdata_manager_debug_level, 0,
            "Debug level for TessdataManager functions.");
  STRING_VAR_H(tessedit_load_sublangs, "",
               "List of languages to load with this one");
  // Min acceptable orientation margin (difference in scores between top and 2nd
  // choice in OSResults::orientations) to believe the page orientation.
  double_VAR_H(min_orientation_margin, 7.0,
               "Min acceptable orientation margin");
  BOOL_VAR_H(textord_tabfind_show_vlines, false, "Debug line finding");
  BOOL_VAR_H(textord_use_cjk_fp_model, FALSE, "Use CJK fixed pitch model");
  BOOL_VAR_H(tessedit_init_config_only, false,
             "Only initialize with the config file. Useful if the instance is "
             "not going to be used for OCR but say only for layout analysis.");
  BOOL_VAR_H(textord_equation_detect, false, "Turn on equation detector");

  //// ambigsrecog.cpp /////////////////////////////////////////////////////////
  FILE *init_recog_training(const STRING &fname);
  void recog_training_segmented(const STRING &fname,
                                PAGE_RES *page_res,
                                volatile ETEXT_DESC *monitor,
                                FILE *output_file);
  void ambigs_classify_and_output(WERD_RES *werd_res,
                                  ROW_RES *row_res,
                                  BLOCK_RES *block_res,
                                  const char *label,
                                  FILE *output_file);

  inline CubeRecoContext *GetCubeRecoContext() { return cube_cntxt_; }

 private:
  // The filename of a backup config file. If not null, then we currently
  // have a temporary debug config file loaded, and backup_config_file_
  // will be loaded, and set to null when debug is complete.
  const char* backup_config_file_;
  // The filename of a config file to read when processing a debug word.
  STRING word_config_;
  // Image used for input to layout analysis and tesseract recognition.
  // May be modified by the ShiroRekhaSplitter to eliminate the top-line.
  Pix* pix_binary_;
  // Unmodified image used for input to cube. Always valid.
  Pix* cube_binary_;
  // Grey-level input image if the input was not binary, otherwise NULL.
  Pix* pix_grey_;
  // Input image resolution after any scaling. The resolution is not well
  // transmitted by operations on Pix, so we keep an independent record here.
  int source_resolution_;
  // The shiro-rekha splitter object which is used to split top-lines in
  // Devanagari words to provide a better word and grapheme segmentation.
  ShiroRekhaSplitter splitter_;
  // Page segmentation/layout
  Textord textord_;
  // True if the primary language uses right_to_left reading order.
  bool right_to_left_;
  Pix* scaled_color_;
  int scaled_factor_;
  FCOORD deskew_;
  FCOORD reskew_;
  TesseractStats stats_;
  // Sub-languages to be tried in addition to this.
  GenericVector<Tesseract*> sub_langs_;
  // Most recently used Tesseract out of this and sub_langs_. The default
  // language for the next word.
  Tesseract* most_recently_used_;
  // The size of the font table, ie max possible font id + 1.
  int font_table_size_;
  // Cube objects.
  CubeRecoContext* cube_cntxt_;
  TesseractCubeCombiner *tess_cube_combiner_;
  // Equation detector. Note: this pointer is NOT owned by the class.
  EquationDetect* equ_detect_;
};

}  // namespace tesseract

#endif  // TESSERACT_CCMAIN_TESSERACTCLASS_H__


text:
/*
 Sergio Mireles
 mireles001@gmail.com
 20130222

 Carousel Maker is a simple and hopefuly handy for someone wishing to create a web carousel component on his/her website

 FIX: 20140209
 Using fade transition won't fadeout the old slide item, it will now wait until the new slide finish fadein
 and the it will be removed. Substitute fadeOut for setTimeout.
 */
var carousel = {
	tweenSpeed  : 1000,
	tweenHold   : 3000,
	tweenType   : 'slide',
	labels      : {
		items   : 'carousel_items',
		viewer  : 'carousel_viewer',
		button  : 'carousel_btn'
	},
	dom         : [],
	init : function (_params){
		if(_params.target != undefined && this.dom[_params.target] == undefined){
			var targetName = '_'+_params.target;
			this.dom[targetName] = {};

			var holder  = $('#'+_params.target),
				items   = $('#'+this.labels.items,holder),
				viewer  = $('#'+this.labels.viewer,holder),
				button  = $('#'+this.labels.button,holder).hide(),
				doms    = [],
				buttons = [],
				index   = 0,
				w       = parseInt(holder.css('width')),
				h       = parseInt(holder.css('height')),
				i;
			items.hide();
			viewer.css('overflow','hidden').css('width',w+'px').css('height',h+'px').css('position','relative').css('z-index','1');
			for(i=0;i<items.children().size();i++){
				doms.push(items.children().eq(i));
			}
			var first = doms[index].clone().css('width',w+'px').css('height',h+'px').css('position','absolute').hide();
			viewer.append(first);

			/*Add nav buttons*/
			if(button.length > 0){
				var buttonLayer  = $('

').css('position','absolute').css('z-index','10'),
					buttonHolder = $('

').css('position','relative'),
					newButton;
				for(i=0;i<doms.length;i++){
					newButton = button.clone().show().attr('id',i+'-'+targetName).css('cursor','pointer').click(function(){
						var params = $(this).attr('id').split('-');
						carousel.goTo({target:params[1],index:parseInt(params[0]),auto:false});
					});
					buttonHolder.append(newButton);
					buttons.push(newButton);
				}
				buttonLayer.append(buttonHolder);
				holder.prepend(buttonLayer);
				this.dom[targetName].buttons = buttons;
			}
			if(_params.autoscroll != undefined && !_params.autoscroll) {
				this.dom[targetName].autoscroll = false;
			}else{
				this.dom[targetName].autoscroll = true;
			}
			if(_params.tween != undefined){
				this.dom[targetName].tween = _params.tween;
			}else{
				this.dom[targetName].tween = this.tweenSpeed;
			}
			if(_params.hold != undefined){
				this.dom[targetName].hold = _params.hold;
			}else{
				this.dom[targetName].hold = this.tweenHold;
			}
			if(this.dom[targetName].hold <= this.dom[targetName].tween){
				this.dom[targetName].hold = this.dom[targetName].tween+1;
			}
			if(_params.type != undefined && _params.type != this.tweenType){
				this.dom[targetName].type = 'fade';
			}else{
				this.dom[targetName].type = this.tweenType;
			}
			this.dom[targetName].viewer = viewer;
			this.dom[targetName].items = doms;
			this.dom[targetName].index = index;
			this.dom[targetName].w = w;
			this.dom[targetName].h = h;
			this.dom[targetName].locked = false;

			first.fadeIn(500,function(){
				$(this).attr('id','old');
				var targetName = '_'+$(this).parent().parent().attr('id');
				if(carousel.dom[targetName].autoscroll){
					carousel.dom[targetName].interval = setInterval(function(){
						carousel.carouselInterval(targetName);
					},carousel.dom[targetName].hold);
				}
				carousel.turnOnOffButton(carousel.dom[targetName],true);
			});
		}
	},
	carouselInterval : function (_targetName){
		var nextItem = carousel.dom[_targetName].index+1;
		if(nextItem >= carousel.dom[_targetName].items.length) { nextItem = 0; }
		carousel.goTo({target:_targetName,index:nextItem,auto:true});
	},
	goTo : function (_params) {
		var blnAnimate = false;

		if(!_params.auto && carousel.dom[_params.target].index != _params.index && !carousel.dom[_params.target].locked){
			if(carousel.dom[_params.target].autoscroll){
				clearInterval(carousel.dom[_params.target].interval);
				carousel.dom[_params.target].interval = setInterval(function(){
					carousel.carouselInterval(_params.target);
				},carousel.dom[_params.target].hold);
			}
			blnAnimate = true;
		}else{
			if(_params.auto){
				blnAnimate = true;
			}
		}

		if(blnAnimate){
			var direction = 1;
			if(_params.index > carousel.dom[_params.target].index || _params.auto){
				direction = -1;
			}

			carousel.dom[_params.target].locked = true;

			this.turnOnOffButton(carousel.dom[_params.target],false);
			carousel.dom[_params.target].index = _params.index;
			this.turnOnOffButton(carousel.dom[_params.target],true);

			var domNew = carousel.dom[_params.target].items[_params.index].clone().attr('id','new')
					.css('position','absolute').css('left','0').css('top','0')
					.css('width',carousel.dom[_params.target].w+'px').css('height',carousel.dom[_params.target].h+'px').hide(),
				domOld = $('#old',carousel.dom[_params.target].viewer);
			carousel.dom[_params.target].viewer.append(domNew);

			if(carousel.dom[_params.target].type == 'slide'){
				domOld.animate({left: '+='+carousel.dom[_params.target].w*direction },carousel.dom[_params.target].tween, function(){
					$(this).remove();
				});
				domNew.show().css('left',carousel.dom[_params.target].w*(-1*direction))
					.animate({left: '+='+carousel.dom[_params.target].w*direction },carousel.dom[_params.target].tween,
					function(){
						$(this).attr('id','old');
						carousel.dom['_'+$(this).parent().parent().attr('id')].locked = false;
					});
			}else if(carousel.dom[_params.target].type == 'fade') {
				setTimeout(function(){ domOld.remove(); },carousel.dom[_params.target].tween);
				domNew.fadeIn(carousel.dom[_params.target].tween,function(){
					$(this).attr('id','old');
					carousel.dom['_'+$(this).parent().parent().attr('id')].locked = false;
				});
			}
		}
	},
	turnOnOffButton : function (_obj,_selectButton) {
		if(_obj.buttons != undefined){
			if(_selectButton){
				if(!_obj.buttons[_obj.index].hasClass('selected')){
					_obj.buttons[_obj.index].addClass('selected');
				}
			}else{
				if(_obj.buttons[_obj.index].hasClass('selected')){
					_obj.buttons[_obj.index].removeClass('selected');
				}
			}
		}
	}
};


text:
namespace DNTProfiler.ApplicationAnnouncements.Core
{
    public static class ProjectConfig
    {
        public static string ProjectReleasesUrl =
            "https://api.github.com/repos/VahidN/DNTProfiler/releases";
    }
}


text:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE help SYSTEM "../../../lib/pkp/dtd/help.dtd">

<!--
  * help.xml
  *
  * Copyright (c) 2000-2012 John Willinsky
  * Distributed under the GNU GPL v2. For full terms see the file docs/COPYING.
  *
  * Help Page Numerical Mappings for this plugin's help.
  *
  * $Id$
  -->
<help>
	<!-- Index -->
	<topic key="plugins.generic.TranslatorPlugin" id="TranslatorPlugin/topic/000000"></topic>
</help>


text:
display_usage() {
        echo -e "This script takes two or three arguments:"
        echo -e " First argument:  'the lambda expression to evaluate'"
        echo -e " Second argument: a or n (i.e., applicative or normal order)"
        echo -e " Third argument:  name (i.e., output will go to AV/scripted/name.html)"
        echo -e "                  This argument is optional. If it is omitted, the "
        echo -e "                  first argument is used as the name of the output file."
	echo -e "Usage:\n\t./create_slideshow <lambda exp> <a or n> <file name> \n"
	}

if [  $# -eq 2 ] || [  $# -eq 3 ]  ; then
  exp=$1
  case "$2" in
   a) order="applicative" ;;
   *) order="normal" ;;
  esac

  if [ $# -eq 3 ] ; then
      name="$3.html"
  else
      name="$1.html"
  fi

echo "var LAMBDA = {};" > tmp.js;
echo "var running_in_node = true;" >> tmp.js
echo "var exp = '${exp}';"  >> tmp.js
echo "var require = undefined;"  >> tmp.js
echo "var order = '${order}';"  >> tmp.js
cat ../version1.4/scripts/grammar.js >> tmp.js
cat ../version1.4/scripts/absyn.js >> tmp.js
cat ../version1.4/scripts/interpreter.js >> tmp.js

cat ./utils/interpreter-top.html > "./AV/scripted/${name}"
echo "var order = '${order}';" >> "./AV/scripted/${name}"
echo "var lambdaexp = '${exp}';" >> "./AV/scripted/${name}"
echo "var reduction_steps = " >> "./AV/scripted/${name}"
node tmp.js >> "./AV/scripted/${name}"
rm tmp.js

if [  ${order} == "applicative" ]
  then
        cat ./utils/interpreter-bottom.html >> "./AV/scripted/${name}"
  else
        sed 's/Applicative/Normal/'  ./utils/interpreter-bottom.html >> "./AV/scripted/${name}"
fi

else
  display_usage
fi


text:
@protocol GHHasDescriptionProtocol <NSObject>

@property (nonatomic, readonly) NSString    * keyword;
@property (nonatomic, readonly) NSString    * name;
@property (nonatomic, readonly) NSString    * desc;

@end


text:
'use strict';

require('source-map-support').install();
const assert = require('assert');

const DefaultContext = require('../../build/jel/DefaultContext.js').default;
const JEL = require('../../build/jel/JEL.js').default;

const {Token, TokenType, RegExpToken, TemplateToken, FractionToken} = require('../../build/jel/Token.js');
const Program = require('../../build/jel/expressionNodes/Program.js').default;
const Literal = require('../../build/jel/expressionNodes/Literal.js').default;
const Variable = require('../../build/jel/expressionNodes/Variable.js').default;
const Operator = require('../../build/jel/expressionNodes/Operator.js').default;
const List = require('../../build/jel/expressionNodes/List.js').default;
const Reference = require('../../build/jel/expressionNodes/Reference.js').default;
const Condition = require('../../build/jel/expressionNodes/Condition.js').default;
const Assignment = require('../../build/jel/expressionNodes/Assignment.js').default;
const Let = require('../../build/jel/expressionNodes/Let.js').default;
const Lambda = require('../../build/jel/expressionNodes/Lambda.js').default;
const TypedParameterDefinition = require('../../build/jel/expressionNodes/TypedParameterDefinition.js').default;
const Call = require('../../build/jel/expressionNodes/Call.js').default;
const MethodCall = require('../../build/jel/expressionNodes/MethodCall.js').default;
const Optional = require('../../build/jel/expressionNodes/Optional.js').default;

const {JelAssert, JelPromise, JelConsole} = require('../jel-assert.js');
const jelAssert = new JelAssert();

const D = new Token(0, 0, '(you should never see this dummy token)', TokenType.Literal, null);

describe('JEL', function() {
  let defaultContext, ctx;
  before(function(){
    return DefaultContext.get().then(dc=> {
      defaultContext = dc;
      ctx = defaultContext;
      jelAssert.setCtx(ctx);
    });
  });

  describe('parseTree', function() {

    it('should parse a simple literal', function() {
      jelAssert.equal(new JEL('5').parseTree, new Literal(D, 5));
      jelAssert.equal(new JEL('+5').parseTree, new Literal(D, 5));
      jelAssert.equal(new JEL('-5').parseTree, new Literal(D, -5));
      jelAssert.equal(new JEL('- 5').parseTree, new Literal(D, -5));
      jelAssert.equal(new JEL('"foo"').parseTree, new Literal(D, 'foo'));
      jelAssert.equal(new JEL('"foo"').parseTree, new Literal(D, 'foo'));
      jelAssert.equal(new JEL('"f\\no\\no"').parseTree, new Literal(D, 'f\no\no'));
    });

    it('should parse variables', function() {
      jelAssert.equal(new JEL('a').parseTree, new Variable(D, 'a'));
      jelAssert.equal(new JEL('a_b_c').parseTree, new Variable(D, 'a_b_c'));
    });

    it('should parse some unary operations', function() {
      jelAssert.equal(new JEL('!a').parseTree, new Operator(D, '!', new Variable(D, 'a')));
      jelAssert.equal(new JEL('!-5').parseTree, new Operator(D, '!', new Literal(D, -5)));
    });

    it('should parse some binary operations', function() {
      jelAssert.equal(new JEL('5+5').parseTree, new Operator(D, '+', new Literal(D, 5), new Literal(D, 5)));
      jelAssert.equal(new JEL('a+b').parseTree, new Operator(D, '+', new Variable(D, 'a'), new Variable(D, 'b')));
      jelAssert.equal(new JEL('a+b+c').parseTree, new Operator(D, '+', new Operator(D, '+', new Variable(D, 'a'), new Variable(D, 'b')), new Variable(D, 'c')));
    });

    it('should support precedence', function() {
      jelAssert.equal(new JEL('a+b*c').parseTree, new Operator(D, '+', new Variable(D, 'a'), new Operator(D, '*', new Variable(D, 'b'), new Variable(D, 'c'))));
    });

    it('should support parens', function() {
      jelAssert.equal(new JEL('(b+c)').parseTree, new Operator(D, '+', new Variable(D, 'b'), new Variable(D, 'c')));
      jelAssert.equal(new JEL('(((((b+c)))))').parseTree, new Operator(D, '+', new Variable(D, 'b'), new Variable(D, 'c')));
      jelAssert.equal(new JEL('a+(b+c)').parseTree, new Operator(D, '+', new Variable(D, 'a'), new Operator(D, '+', new Variable(D, 'b'), new Variable(D, 'c'))));
      jelAssert.equal(new JEL('(a+b)+c+(((d*e)))').parseTree, new JEL('a+b+c+d*e').parseTree);
    });

    it('should support function calls', function() {
      jelAssert.equal(new JEL('f()').parseTree, new Call(D, new Variable(D, 'f'), []));
      jelAssert.equal(new JEL('f(2)').parseTree, new Call(D, new Variable(D, 'f'), [new Literal(D, 2)]));
      jelAssert.equal(new JEL('f("foo", 2)').parseTree, new Call(D, new Variable(D, 'f'), [new Literal(D, 'foo'), new Literal(D, 2)]));

      jelAssert.equal(new JEL('f(a=5)').parseTree, new Call(D, new Variable(D, 'f'), [], [new Assignment(D, 'a', new Literal(D, 5))]));
      jelAssert.equal(new JEL('f("foo", 4, a = 5, b = "bar")').parseTree, new Call(D, new Variable(D, 'f'), [new Literal(D, 'foo'), new Literal(D, 4)], [new Assignment(D, 'a', new Literal(D, 5)), new Assignment(D, 'b', new Literal(D, 'bar'))]));

      jelAssert.equal(new JEL('(f)()').parseTree, new Call(D, new Variable(D, 'f'), []));
      jelAssert.equal(new JEL('g(a=>2)').parseTree, new Call(D, new Variable(D, 'g'), [new Lambda(D, [new TypedParameterDefinition(D, 'a')], undefined, new Literal(D, 2))]));
      jelAssert.equal(new JEL('g((a,b,c)=>2)').parseTree, new Call(D, new Variable(D, 'g'), [new Lambda(D, [new TypedParameterDefinition(D, 'a'), new TypedParameterDefinition(D, 'b'), new TypedParameterDefinition(D, 'c')], undefined, new Literal(D, 2))]));
    });

    it('should support method calls', function() {
      jelAssert.equal(new JEL('a.f()').parseTree, new MethodCall(D, new Variable(D, 'a'), 'f', []));
      jelAssert.equal(new JEL('a.f(2)').parseTree, new MethodCall(D, new Variable(D, 'a'), 'f', [new Literal(D, 2)]));
      jelAssert.equal(new JEL('a.f("foo", 2)').parseTree, new MethodCall(D, new Variable(D, 'a'), 'f', [new Literal(D, 'foo'), new Literal(D, 2)]));

      jelAssert.equal(new JEL('a.f(a=5)').parseTree, new MethodCall(D, new Variable(D, 'a'), 'f', [], [new Assignment(D, 'a', new Literal(D, 5))]));
      jelAssert.equal(new JEL('a.f("foo", 4, a = 5, b = "bar")').parseTree, new MethodCall(D, new Variable(D, 'a'), 'f', [new Literal(D, 'foo'), new Literal(D, 4)], [new Assignment(D, 'a', new Literal(D, 5)), new Assignment(D, 'b', new Literal(D, 'bar'))]));
    });

    it('should support lambdas', function() {
      jelAssert.equal(new JEL('x=>1').parseTree, new Lambda(D, [new TypedParameterDefinition(D, 'x')], undefined, new Literal(D, 1)));
      jelAssert.equal(new JEL('()=>1').parseTree, new Lambda(D, [], undefined, new Literal(D, 1)));
      jelAssert.equal(new JEL('(a, b)=>a+b').parseTree, new Lambda(D, [new TypedParameterDefinition(D, 'a'), new TypedParameterDefinition(D, 'b')], undefined, new Operator(D, '+', new Variable(D, 'a'), new Variable(D, 'b'))));
      jelAssert.equal(new JEL('(a=>a)(1)').parseTree, new Call(D, new Lambda(D, [new TypedParameterDefinition(D, 'a')], undefined, new Variable(D, 'a')), [new Literal(D, 1)]));
      jelAssert.equal(new JEL('(a=>a*a)(1)').parseTree, new Call(D, new Lambda(D, [new TypedParameterDefinition(D, 'a')], undefined, new Operator(D, '*', new Variable(D, 'a'), new Variable(D, 'a'))), [new Literal(D, 1)]));
      jelAssert.equal(new JEL('((a, b)=>a+b)(1,2)').parseTree, new Call(D, new Lambda(D, [new TypedParameterDefinition(D, 'a'), new TypedParameterDefinition(D, 'b')], undefined, new Operator(D, '+', new Variable(D, 'a'), new Variable(D, 'b'))), [new Literal(D, 1),  new Literal(D, 2)]));
      jelAssert.equal(new JEL('(a="x")=>a').parseTree, new Lambda(D, [new TypedParameterDefinition(D, 'a', new Literal(D, 'x'))], undefined, new Variable(D, 'a')));
      jelAssert.equal(new JEL('(a: LocalDate)=>a').parseTree, new Lambda(D, [new TypedParameterDefinition(D, 'a', undefined, new Variable(D, 'LocalDate'))], undefined, new Variable(D, 'a')));
      jelAssert.equal(new JEL('(a: String = "y"): String=>a').parseTree, new Lambda(D, [new TypedParameterDefinition(D, 'a', new Literal(D, 'y'), new Variable(D, 'String'))], new TypedParameterDefinition(D, 'return value', undefined, new Variable(D, 'String')), new Variable(D, 'a')));
      jelAssert.equal(new JEL('((a = 12, b: String, c: Float = 1): String=>a+b)(1,2)').parseTree, new Call(D, new Lambda(D, [new TypedParameterDefinition(D, 'a', new Literal(D, 12)),
                                                                                new TypedParameterDefinition(D, 'b', null, new Variable(D, 'String')),
                                                                                new TypedParameterDefinition(D, 'c', new Literal(D, 1), new Variable(D, 'Float'))], new TypedParameterDefinition(D, 'return value', undefined, new Variable(D, 'String')),
                                                                                new Operator(D, '+', new Variable(D, 'a'), new Variable(D, 'b'))), [new Literal(D, 1),  new Literal(D, 2)]));
    });

    it('should support if/then/else', function() {
      jelAssert.equal(new JEL('if a then b else c').parseTree, new Condition(D, new Variable(D, 'a'), new Variable(D, 'b'), new Variable(D, 'c')));
      jelAssert.equal(new JEL('if (a!=0) then ((b)) else f()').parseTree, new Condition(D, new Operator(D, '!=', new Variable(D, 'a'), new Literal(D, 0)), new Variable(D, 'b'), new Call(D, new Variable(D, 'f'), [])));
      assert.throws(()=>new JEL('if a else b'));
      jelAssert.equal(new JEL("if false then (if false then 2 else 1) else 6").parseTree, new Condition(D, new Literal(D, false), new Condition(D, new Literal(D, false), new Literal(D, 2), new Literal(D, 1)), new Literal(D, 6)));
    });

    it('allows only lower-case variables', function() {
      assert.throws(()=>new JEL('do let A= 1 => a').parseTree);
      assert.throws(()=>new JEL('do let _=2 => 2').parseTree);
    });

    it('should support lists', function() {
      jelAssert.equal(new JEL('[]').parseTree, new List(D, []));
      jelAssert.equal(new JEL('[a]').parseTree, new List(D, [new Variable(D, 'a')]));
      jelAssert.equal(new JEL('[a+2,a]').parseTree, new List(D, [new Operator(D, '+', new Variable(D, 'a'), new Literal(D, 2)), new Variable(D, 'a')]));
    });

    it('should support optionals', function() {
      jelAssert.equal(new JEL('LocalDate?').parseTree, new Optional(D, new Variable(D, 'LocalDate')));
      jelAssert.equal(new JEL('@LocalDate?').parseTree, new Optional(D, new Reference(D, 'LocalDate')));
      jelAssert.equal(new JEL('(LocalDate)?').parseTree, new Optional(D, new Variable(D, 'LocalDate')));
    });

  });
});


text:
'use strict'
const { createSuite } = require('../utils/suite')

const tests = {
  publish: require('./publish'),
  resolve: require('./resolve')
}

module.exports = createSuite(tests)


text:
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Net;
using GalleryBackend;
using IndexBackend;
using IndexBackend.Indexing;
using NUnit.Framework;

namespace SlideshowCreator.Tests
{
    class TheAthenaeumIndexingTests
    {
        private readonly Throttle throttle = new Throttle();
        private readonly PrivateConfig privateConfig = PrivateConfig.CreateFromPersonalJson();
        private TheAthenaeumIndexer transientClassifier;
        private VpnCheck vpnCheck;

        [OneTimeSetUp]
        public void Setup_All_Tests_Once_And_Only_Once()
        {
            ServicePointManager.DefaultConnectionLimit = int.MaxValue;
            transientClassifier = new TheAthenaeumIndexer(privateConfig.PageNotFoundIndicatorText, GalleryAwsCredentialsFactory.DbClient, PublicConfig.TheAthenaeumArt);

            vpnCheck = new VpnCheck(new GalleryClient("tgonzalez.net", privateConfig.GalleryUsername, privateConfig.GalleryPassword));
            vpnCheck.AssertVpnInUse(privateConfig.DecryptedIp);
        }

        [Test]
        public void A_Check_Throttle()
        {
            var expectedMaxWaitInMs = 1000;

            var timer = new Stopwatch();
            timer.Start();
            throttle.HoldBack();
            timer.Stop();

            Assert.IsTrue(timer.ElapsedMilliseconds > 1 && timer.ElapsedMilliseconds < expectedMaxWaitInMs);

            timer = new Stopwatch();
            timer.Start();
            throttle.HoldBack();
            timer.Stop();
            Assert.IsTrue(timer.ElapsedMilliseconds > 1 && timer.ElapsedMilliseconds < expectedMaxWaitInMs);

            timer = new Stopwatch();
            timer.Start();
            throttle.HoldBack();
            timer.Stop();
            Assert.IsTrue(timer.ElapsedMilliseconds > 1 && timer.ElapsedMilliseconds < expectedMaxWaitInMs);
        }

        [Test]
        public void B_Reclassify_Jean_Leon_Gerome_Sample()
        {
            var classification = transientClassifier.Index(15886);

            Assert.AreEqual("http://www.the-athenaeum.org", classification.Source);
            Assert.AreEqual(15886, classification.PageId);
            Assert.AreEqual(153045, classification.ImageId);
            Assert.AreEqual("The Slave Market", classification.Name);
            Assert.AreEqual("jean-leon gerome", classification.Artist);
            Assert.AreEqual("Jean-Léon Gérôme", classification.OriginalArtist);
            Assert.AreEqual("1866", classification.Date);
        }

        [Test]
        public void B_Check_Sample1()
        {
            var pageId = 2594;
            var classification = transientClassifier.Index(pageId);
            Assert.AreEqual(pageId, classification.PageId);
            Assert.AreEqual("The Banks of the River", classification.Name);
            Assert.AreEqual("charles-francois daubigny", classification.Artist);
            Assert.AreEqual("Date unknown", classification.Date);
            Assert.AreEqual(5154, classification.ImageId);
        }

        [Test]
        public void B_Check_Sample2()
        {
            var pageId = 33;
            var classification = transientClassifier.Index(pageId);
            Assert.AreEqual("The Mandolin Player", classification.Name);
            Assert.AreEqual("dante gabriel rossetti", classification.Artist);
            Assert.AreEqual("1869", classification.Date);
            Assert.AreEqual(736170, classification.ImageId);
        }

        [Test]
        public void B_Check_Sample_With_Alternbate_Title()
        {
            var pageId = 10005;
            var classification = transientClassifier.Index(pageId);
            Assert.AreEqual("Rotterdam", classification.Name);
            Assert.AreEqual("johan barthold jongkind", classification.Artist);
            Assert.AreEqual("circa 1871", classification.Date);
            Assert.AreEqual(20117, classification.ImageId);
        }

        [Test]
        public void B_Check_Sample_With_Alternbate_Title2()
        {
            var pageId = 10163;
            var classification = transientClassifier.Index(pageId);
            Assert.AreEqual("photo of balla in futurist outfit", classification.Name);
            Assert.AreEqual(Classifier.UNKNOWN_ARTIST, classification.Artist);
            Assert.AreEqual(string.Empty, classification.Date);
            Assert.AreEqual(20441, classification.ImageId);
        }

        [Test]
        public void B_Check_Sample_With_Alternbate_Title3()
        {
            var pageId = 48407;
            var classification = transientClassifier.Index(pageId);
            Assert.AreEqual("Man", classification.Name);
            Assert.AreEqual(Classifier.UNKNOWN_ARTIST, classification.Artist);
            Assert.AreEqual(string.Empty, classification.Date);
            Assert.AreEqual(0, classification.ImageId);
        }

        [Test]
        public void B_Check_Sample_With_Null_Reference_Exception()
        {
            var pageId = 137;
            var classification = transientClassifier.Index(pageId);
            Assert.IsNull(classification);
        }

        [Test]
        public void B_Check_Dynamo_Db_Required_Field_Failure()
        {
            var pageId = 127930;
            var classification = transientClassifier.Index(pageId);
            Assert.AreEqual(Classifier.UNKNOWN_ARTIST, classification.Artist);
            Assert.AreEqual(Classifier.UNKNOWN_ARTIST, classification.OriginalArtist);
        }

        //[Test]
        public void C_Create_Classification_File_Queue()
        {
            List<string> pageIdQueue = new List<string>();
            for (int pageId = 33; pageId < 292400; pageId += 1)
            {
                pageIdQueue.Add(pageId.ToString());
            }
            File.WriteAllLines("C:\\Users\\peon\\Desktop\\projects\\SlideshowCreator\\PageIdQueue.txt", pageIdQueue);
        }

    }
}


text: React components based on echarts.


text:
<?php
/* vim: set expandtab sw=4 ts=4 sts=4: */
/**
 * hold PhpMyAdmin\Twig\IndexExtension class
 *
 * @package PhpMyAdmin\Twig
 */
namespace PhpMyAdmin\Twig;

use Twig\Extension\AbstractExtension;
use Twig\TwigFunction;

/**
 * Class IndexExtension
 *
 * @package PhpMyAdmin\Twig
 */
class IndexExtension extends AbstractExtension
{
    /**
     * Returns a list of functions to add to the existing list.
     *
     * @return TwigFunction[]
     */
    public function getFunctions()
    {
        return array(
            new TwigFunction(
                'Index_getHtmlForDisplayIndexes',
                'PhpMyAdmin\Index::getHtmlForDisplayIndexes',
                array('is_safe' => array('html'))
            ),
        );
    }
}


text:
package org.apereo.cas.configuration.model.core.authentication;

import org.apereo.cas.configuration.model.SpringResourceProperties;
import org.apereo.cas.configuration.support.RequiresModule;

import lombok.Getter;
import lombok.Setter;
import lombok.experimental.Accessors;
import org.springframework.boot.context.properties.NestedConfigurationProperty;

import java.io.Serializable;

/**
 * This is {@link AttributeDefinitionStoreProperties}.
 *
 * @author Misagh Moayyed
 * @since 6.4.0
 */
@RequiresModule(name = "cas-server-core-authentication", automated = true)
@Getter
@Setter
@Accessors(chain = true)
public class AttributeDefinitionStoreProperties implements Serializable {
    private static final long serialVersionUID = 1248812041234879300L;

    /**
     * Load attribute definitions from a JSON resource.
     */
    @NestedConfigurationProperty
    private SpringResourceProperties json = new SpringResourceProperties();
}


text:
from core.config.settings import MY_ACCOUNTS, PEOPLE
from core.utils.network.email import send

def report_bug(message):
    """docstring for report"""
    send(MY_ACCOUNTS['gmail']['email'], PEOPLE['admin']['email'], 'Smarty-bot bug report', message)


text: A rough pass at an ELB log processor


text:
require 'test_helper'

module ElginccEngine
  class Tt::CalendarHelperTest < ActionView::TestCase
  end
end


text:
package windows

import (
	"context"
	"crypto/x509"
	"encoding/asn1"
	"testing"
	"time"

	"github.com/stretchr/testify/require"

	"github.com/gravitational/teleport/api/types"
	"github.com/gravitational/teleport/lib/auth"
)

// TestGenerateCredentials verifies that the smartcard certificates generated
// by Teleport meet the requirements for Windows logon.
func TestGenerateCredentials(t *testing.T) {
	const (
		clusterName = "test"
		user        = "test-user"
		domain      = "test.example.com"
	)

	authServer, err := auth.NewTestAuthServer(auth.TestAuthServerConfig{
		ClusterName: clusterName,
		Dir:         t.TempDir(),
	})
	require.NoError(t, err)
	t.Cleanup(func() {
		require.NoError(t, authServer.Close())
	})

	tlsServer, err := authServer.NewTestTLSServer()
	require.NoError(t, err)
	t.Cleanup(func() {
		require.NoError(t, tlsServer.Close())
	})

	client, err := tlsServer.NewClient(auth.TestServerID(types.RoleWindowsDesktop, "test-host-id"))
	require.NoError(t, err)
	t.Cleanup(func() {
		require.NoError(t, client.Close())
	})

	ldapConfig := LDAPConfig{
		Domain: domain,
	}
	ctx, cancel := context.WithTimeout(context.Background(), 10*time.Second)
	defer cancel()

	certb, keyb, err := GenerateCredentials(ctx, user, domain, CertTTL, clusterName, ldapConfig, client)
	require.NoError(t, err)
	require.NotNil(t, certb)
	require.NotNil(t, keyb)

	cert, err := x509.ParseCertificate(certb)
	require.NoError(t, err)
	require.NotNil(t, cert)

	require.Equal(t, user, cert.Subject.CommonName)
	require.Contains(t, cert.CRLDistributionPoints,
		`ldap:///CN=test,CN=Teleport,CN=CDP,CN=Public Key Services,CN=Services,CN=Configuration,DC=test,DC=example,DC=com?certificateRevocationList?base?objectClass=cRLDistributionPoint`)

	foundKeyUsage := false
	foundAltName := false
	for _, extension := range cert.Extensions {
		switch {
		case extension.Id.Equal(EnhancedKeyUsageExtensionOID):
			foundKeyUsage = true
			var oids []asn1.ObjectIdentifier
			_, err = asn1.Unmarshal(extension.Value, &oids)
			require.NoError(t, err)
			require.Len(t, oids, 2)
			require.Contains(t, oids, ClientAuthenticationOID)
			require.Contains(t, oids, SmartcardLogonOID)

		case extension.Id.Equal(SubjectAltNameExtensionOID):
			foundAltName = true
			var san SubjectAltName
			_, err = asn1.Unmarshal(extension.Value, &san)
			require.NoError(t, err)

			require.Equal(t, san.OtherName.OID, UPNOtherNameOID)
			require.Equal(t, san.OtherName.Value.Value, user+"@"+domain)
		}
	}
	require.True(t, foundKeyUsage)
	require.True(t, foundAltName)
}


text:
/*************************************************************************/
/*  effects_rd.h                                                         */
/*************************************************************************/
/*                       This file is part of:                           */
/*                           GODOT ENGINE                                */
/*                      https://godotengine.org                          */
/*************************************************************************/
/* Copyright (c) 2007-2022 Juan Linietsky, Ariel Manzur.                 */
/* Copyright (c) 2014-2022 Godot Engine contributors (cf. AUTHORS.md).   */
/*                                                                       */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the       */
/* "Software"), to deal in the Software without restriction, including   */
/* without limitation the rights to use, copy, modify, merge, publish,   */
/* distribute, sublicense, and/or sell copies of the Software, and to    */
/* permit persons to whom the Software is furnished to do so, subject to */
/* the following conditions:                                             */
/*                                                                       */
/* The above copyright notice and this permission notice shall be        */
/* included in all copies or substantial portions of the Software.       */
/*                                                                       */
/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,       */
/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF    */
/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY  */
/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,  */
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE     */
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.                */
/*************************************************************************/

#ifndef EFFECTS_RD_H
#define EFFECTS_RD_H

#include "core/math/projection.h"
#include "servers/rendering/renderer_rd/pipeline_cache_rd.h"
#include "servers/rendering/renderer_rd/shaders/luminance_reduce.glsl.gen.h"
#include "servers/rendering/renderer_rd/shaders/luminance_reduce_raster.glsl.gen.h"
#include "servers/rendering/renderer_rd/shaders/roughness_limiter.glsl.gen.h"
#include "servers/rendering/renderer_rd/shaders/sort.glsl.gen.h"
#include "servers/rendering/renderer_scene_render.h"

#include "servers/rendering_server.h"

class EffectsRD {
private:
	bool prefer_raster_effects;

	enum LuminanceReduceMode {
		LUMINANCE_REDUCE_READ,
		LUMINANCE_REDUCE,
		LUMINANCE_REDUCE_WRITE,
		LUMINANCE_REDUCE_MAX
	};

	struct LuminanceReducePushConstant {
		int32_t source_size[2];
		float max_luminance;
		float min_luminance;
		float exposure_adjust;
		float pad[3];
	};

	struct LuminanceReduce {
		LuminanceReducePushConstant push_constant;
		LuminanceReduceShaderRD shader;
		RID shader_version;
		RID pipelines[LUMINANCE_REDUCE_MAX];
	} luminance_reduce;

	enum LuminanceReduceRasterMode {
		LUMINANCE_REDUCE_FRAGMENT_FIRST,
		LUMINANCE_REDUCE_FRAGMENT,
		LUMINANCE_REDUCE_FRAGMENT_FINAL,
		LUMINANCE_REDUCE_FRAGMENT_MAX
	};

	struct LuminanceReduceRasterPushConstant {
		int32_t source_size[2];
		int32_t dest_size[2];
		float exposure_adjust;
		float min_luminance;
		float max_luminance;
		uint32_t pad1;
	};

	struct LuminanceReduceFragment {
		LuminanceReduceRasterPushConstant push_constant;
		LuminanceReduceRasterShaderRD shader;
		RID shader_version;
		PipelineCacheRD pipelines[LUMINANCE_REDUCE_FRAGMENT_MAX];
	} luminance_reduce_raster;

	struct RoughnessLimiterPushConstant {
		int32_t screen_size[2];
		float curve;
		uint32_t pad;
	};

	struct RoughnessLimiter {
		RoughnessLimiterPushConstant push_constant;
		RoughnessLimiterShaderRD shader;
		RID shader_version;
		RID pipeline;

	} roughness_limiter;

	enum SortMode {
		SORT_MODE_BLOCK,
		SORT_MODE_STEP,
		SORT_MODE_INNER,
		SORT_MODE_MAX
	};

	struct Sort {
		struct PushConstant {
			uint32_t total_elements;
			uint32_t pad[3];
			int32_t job_params[4];
		};

		SortShaderRD shader;
		RID shader_version;
		RID pipelines[SORT_MODE_MAX];
	} sort;

	RID default_sampler;
	RID default_mipmap_sampler;
	RID index_buffer;
	RID index_array;

	HashMap<RID, RID> texture_to_uniform_set_cache;
	HashMap<RID, RID> input_to_uniform_set_cache;

	HashMap<RID, RID> image_to_uniform_set_cache;

	struct TexturePair {
		RID texture1;
		RID texture2;
		_FORCE_INLINE_ bool operator<(const TexturePair &p_pair) const {
			if (texture1 == p_pair.texture1) {
				return texture2 < p_pair.texture2;
			} else {
				return texture1 < p_pair.texture1;
			}
		}
	};

	struct TextureSamplerPair {
		RID texture;
		RID sampler;
		_FORCE_INLINE_ bool operator<(const TextureSamplerPair &p_pair) const {
			if (texture == p_pair.texture) {
				return sampler < p_pair.sampler;
			} else {
				return texture < p_pair.texture;
			}
		}
	};

	RBMap<TexturePair, RID> texture_pair_to_uniform_set_cache;
	RBMap<RID, RID> texture_to_compute_uniform_set_cache;
	RBMap<TexturePair, RID> texture_pair_to_compute_uniform_set_cache;
	RBMap<TexturePair, RID> image_pair_to_compute_uniform_set_cache;
	RBMap<TextureSamplerPair, RID> texture_sampler_to_compute_uniform_set_cache;

	RID _get_uniform_set_from_image(RID p_texture);
	RID _get_uniform_set_from_texture(RID p_texture, bool p_use_mipmaps = false);
	RID _get_compute_uniform_set_from_texture(RID p_texture, bool p_use_mipmaps = false);

public:
	bool get_prefer_raster_effects();

	void luminance_reduction(RID p_source_texture, const Size2i p_source_size, const Vector<RID> p_reduce, RID p_prev_luminance, float p_min_luminance, float p_max_luminance, float p_adjust, bool p_set = false);
	void luminance_reduction_raster(RID p_source_texture, const Size2i p_source_size, const Vector<RID> p_reduce, Vector<RID> p_fb, RID p_prev_luminance, float p_min_luminance, float p_max_luminance, float p_adjust, bool p_set = false);

	void roughness_limit(RID p_source_normal, RID p_roughness, const Size2i &p_size, float p_curve);

	void sort_buffer(RID p_uniform_set, int p_size);

	EffectsRD(bool p_prefer_raster_effects);
	~EffectsRD();
};

#endif // EFFECTS_RD_H


text:
@class ASPlaylist;

@interface ASPlaylistItem : NSObject

- (id)initWithID:(NSNumber *)itemID name:(NSString *)name path:(NSString *)filePath playlist:(ASPlaylist *)playlist;
- (BOOL)changeName:(NSString *)name;
- (BOOL)delete;

@property (nonatomic, strong, readonly) NSNumber *itemID;
@property (nonatomic, strong, readonly) ASPlaylist *playlist;
@property (nonatomic, strong, readonly) NSString *name;
@property (nonatomic, strong, readonly) NSString *filePath;

@end