# coding: utf-8

# This file is a part of TaCo: a morphosyntactic tagset converter
#
# License: GPL v. 3
# Author: Bartosz Zaborowski
#

class Configuration
  
DEFAULTS = '
@c50_path = "c5.0"

# partyzantka dopasowywania korpusow do treningu
# 
# format: [lista_tokenow_1, lista_tokenow_1] => [akcja1, akcja2, przesuniecie1, przesuniecie2]
# gdzie: lista_tokenow to lista par ["orth", "tag"]
# akcja to: nil (pominiecie tokenu), :copy (skopiowanie tokenu) lub
#   ["orth", lista_interpretacji] gdzie lista_interpretacji
#      to lista trojek ["base", "tag", golden?]
# 

@special_alignment_corrections = {
  [[["-", "interp"]], [["", "ns"], [".", "interp"], ["DIALOGUE_TURN", "ign"]]] => [nil, nil, 0,2],
  [[["-", "interp"]], [["DIALOGUE_TURN", "ign"]]] => [:copy, ["-", [["-", "interp", true]]], 1, 1]
}

@serialize_corpora_on_evaluation = true
@number_of_folds_on_evaluation = 10

@options = {
  :classifier_options=>{"c"=>50},
  :special_left_context_size=>2,
  :special_right_context_size=>1,
  :left_context_size=>1,
  :right_context_size=>1,
  :orth_prefix_size=>0,
  :orth_suffix_size=>3,
  :special_orth_prefix_size=>0,
  :special_base_prefix_size=>1,
  :special_orth_suffix_size=>2,
  :special_base_suffix_size=>1,
  :threshold=>0.5,
  :folds=>10
}

@tmpdir = "/tmp"
@delete_temporary_files = true

@debug_level = 0


#morphoanalyser settings

@use_morphoanalyser = true

@morfeusz_path = "morfeusz"

@meta_toks = [["DELETED", "_", "END", "_", "OF", "_", "SENTENCE"],
  ["DELETED", "_", "CHARACTERS"],
  ["DELETED", "_", "TOKEN"],
  ["DELETED", "_", "BEGINNING", "_", "OF", "_", "SENTENCE"]
]

@meta_tag = "ign"

@concatenate_special_suffixes = [
  /^em$/,
  /(ów|ach|om|em)$/,
  /^owcy$/,
  /(jeden|dwa|trzy|cztery|pięć|sześć|siedem|osiem|dziewięć)$/
]

@concatenate_special_no_suffix = [
  /^(śmy|[eao]ś|ście)$/
]

@together = [/^.*ś$/]

@interp_tag = "interp"
'

  class << self
    attr_accessor :options, :c50_path, :special_alignment_corrections, :serialize_corpora_on_evaluation,
    :number_of_folds_on_evaluation, :tmpdir, :delete_temporary_files, :debug_level, 
    :morfeusz_path, :meta_toks, :meta_tag, :concatenate_special_suffixes, :together, :interp_tag,
    :concatenate_special_no_suffix, :use_morphoanalyser
  end

  def self.initialize_defaults
    setup DEFAULTS, false
  end

  def self.setup str, is_a_file = true
    str = File.open(str, "r"){|f| f.read} if is_a_file

    eval(str)
  end
end


Configuration.initialize_defaults


