class_docstr: NMT re-ranking.
  
  Args:
     alpha (float): Length parameter.
     beta (float):  Coverage parameter.
     length_penalty (str): Length penalty strategy.
     coverage_penalty (str): Coverage penalty strategy.
  
  Attributes:
      alpha (float): See above.
      beta (float): See above.
      length_penalty (callable): See :class:`penalties.PenaltyBuilder`.
      coverage_penalty (callable): See :class:`penalties.PenaltyBuilder`.
      has_cov_pen (bool): See :class:`penalties.PenaltyBuilder`.
      has_len_pen (bool): See :class:`penalties.PenaltyBuilder`.
class_docstr_tok: ["NMT","re-ranking",".","Args",":","alpha","(","float",")",":","Length","parameter",".","beta","(","float",")",":","Coverage","parameter",".","length_penalty","(","str",")",":","Length","penalty","strategy",".","coverage_penalty","(","str",")",":","Coverage","penalty","strategy",".","Attributes",":","alpha","(","float",")",":","See","above",".","beta","(","float",")",":","See","above",".","length_penalty","(","callable",")",":","See",":","class",":","`","penalties.PenaltyBuilder","`",".","coverage_penalty","(","callable",")",":","See",":","class",":","`","penalties.PenaltyBuilder","`",".","has_cov_pen","(","bool",")",":","See",":","class",":","`","penalties.PenaltyBuilder","`",".","has_len_pen","(","bool",")",":","See",":","class",":","`","penalties.PenaltyBuilder","`","."]
code: def from_opt(cls, opt):
      return cls(
          opt.alpha, opt.beta, opt.length_penalty, opt.coverage_penalty
      )
  
imports: import torch
  from onmt.translate import penalties
  from onmt.translate.decode_strategy import DecodeStrategy
  import warnings
label_desc: Use image node_id 1 for calling the GNMTGlobalScorer obj's underlying member method code with example usage: obj.from_opt(cls, opt) and returns: cls