Welcome to mirror list, hosted at ThFree Co, Russian Federation.

OOVHandlingOptions.cpp « parameters « moses - github.com/moses-smt/mosesdecoder.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 1540746643fa2bc09ca2ced76051553c483a8041 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
// -*- mode: c++; indent-tabs-mode: nil; tab-width: 2 -*-
#include "OOVHandlingOptions.h"
#include <vector>
#include <iostream>
#include "moses/StaticData.h"
#include "moses/TypeDef.h"

namespace Moses {

  OOVHandlingOptions::
  OOVHandlingOptions()
  { 
    drop = false;
    mark = false;
    prefix = "UNK";
    suffix = "";
    word_deletion_enabled = false;
    always_create_direct_transopt = false;
  }

  bool
  OOVHandlingOptions::
  init(Parameter const& param)
  {
    param.SetParameter(drop,"drop-unknown",false);
    param.SetParameter(mark,"mark-unknown",false);
    param.SetParameter(word_deletion_enabled, "phrase-drop-allowed", false);
    param.SetParameter(always_create_direct_transopt, "always-create-direct-transopt", false);
    param.SetParameter<std::string>(prefix,"unknown-word-prefix","UNK");
    param.SetParameter<std::string>(suffix,"unknown-word-suffix","");
    return true;
  }


#ifdef HAVE_XMLRPC_C
  bool 
  OOVHandlingOptions::
  update(std::map<std::string,xmlrpc_c::value>const& param)
  {
    typedef std::map<std::string, xmlrpc_c::value> params_t;
    // params_t::const_iterator si = param.find("xml-input");
    // if (si != param.end())
    //   xml_policy = Scan<XmlInputType>(xmlrpc_c::value_string(si->second));
    return true;
  }
#endif

}