from typing import AbstractSet, Sequence, Tuple

from ..alignment import AlignmentModelType, AlignmentModel

class OnlineTrainingParameters:
    algorithm: int
    learning_rate_policy: int
    learn_step_size: float
    em_iters: int
    e: int
    r: int

    def __init__(self) -> None: ...

class SmtModel:
    def __init__(self, model_type: AlignmentModelType) -> None: ...
    @property
    def non_monotonicity(self) -> int: ...
    @non_monotonicity.setter
    def non_monotonicity(self, value: int) -> None: ...
    @property
    def w(self) -> float: ...
    @w.setter
    def w(self, value: float) -> None: ...
    @property
    def a(self) -> int: ...
    @a.setter
    def a(self, value: int) -> None: ...
    @property
    def e(self) -> int: ...
    @e.setter
    def e(self, value: int) -> None: ...
    @property
    def heuristic(self) -> int: ...
    @heuristic.setter
    def heuristic(self, value: int) -> None: ...
    @property
    def online_training_parameters(self) -> OnlineTrainingParameters: ...
    @online_training_parameters.setter
    def online_training_parameters(self, value: OnlineTrainingParameters) -> None: ...
    @property
    def weights(self) -> Sequence[float]: ...
    @weights.setter
    def weights(self, value: Sequence[float]) -> None: ...
    @property
    def direct_word_alignment_model(self) -> AlignmentModel: ...
    @property
    def inverse_word_alignment_model(self) -> AlignmentModel: ...
    def load_translation_model(self, prefix_filename: str) -> bool: ...
    def load_language_model(self, prefix_filename: str) -> bool: ...
    def print_translation_model(self, prefix_filename: str) -> bool: ...
    def print_language_model(self, prefix_filename: str) -> bool: ...
    def clear(self) -> None: ...

class TranslationData:
    target: Sequence[str]
    source_segmentation: Sequence[Tuple[int, int]]
    target_segment_cuts: Sequence[int]
    target_unknown_words: AbstractSet[int]
    score: float
    score_components: Sequence[float]

class WordGraphArc:
    in_state: int
    out_state: int
    score: float
    words: Sequence[str]
    source_start_index: int
    source_end_index: int
    is_unknown: bool

class WordGraphState:
    in_arc_ids: Sequence[int]
    out_arc_ids: Sequence[int]

class WordGraph:
    @property
    def empty(self) -> bool: ...
    @property
    def num_arcs(self) -> int: ...
    @property
    def num_states(self) -> int: ...
    @property
    def initial_state_score(self) -> float: ...
    @property
    def final_states(self) -> AbstractSet[int]: ...
    def get_in_arc_ids(self, state_id: int) -> Sequence[int]: ...
    def get_out_arc_ids(self, state_id: int) -> Sequence[int]: ...
    def get_arc(self, arc_id: int) -> WordGraphArc: ...
    def get_state(self, state_id: int) -> WordGraphState: ...
    def is_final_state(self, state_id: int) -> bool: ...

class SmtDecoder:
    def __init__(self, model: SmtModel) -> None: ...
    @property
    def i(self) -> int: ...
    @i.setter
    def i(self, value: int) -> None: ...
    @property
    def s(self) -> int: ...
    @s.setter
    def s(self, value: int) -> None: ...
    @property
    def is_breadth_first(self) -> bool: ...
    @is_breadth_first.setter
    def is_breadth_first(self, value: bool) -> None: ...
    def translate(self, sentence: str) -> TranslationData: ...
    def translate_batch(self, sentences: Sequence[str]) -> Sequence[TranslationData]: ...
    def translate_n(self, sentence: str, n: int) -> Sequence[TranslationData]: ...
    def translate_n_batch(self, sentences: Sequence[str], n: int) -> Sequence[Sequence[TranslationData]]: ...
    def get_word_graph(self, sentence: str) -> WordGraph: ...
    def train_sentence_pair(self, source_sentence: str, target_sentence: str) -> bool: ...
    def clear(self) -> None: ...

class PhraseExtractParameters:
    monotone: bool
    max_target_phrase_length: int
    constrain_source_length: bool
    count_spurious: bool
    max_combs_in_table: int

    def __init__(self) -> None: ...

class PhraseModel:
    def __init__(self) -> None: ...
    def build(self, alignment_filename: str, parameters: PhraseExtractParameters, pseudo_ml: bool) -> bool: ...
    def print_phrase_table(self, filename: str, n: int = -1) -> bool: ...
    def clear(self) -> None: ...

class AlignmentExtractor:
    def __init__(self) -> None: ...
    def open(self, filename: str, file_format: int = 0) -> bool: ...
    def intersect(self, alignment_filename: str, output_filename: str, transpose: bool = False) -> bool: ...
    def sum(self, alignment_filename: str, output_filename: str, transpose: bool = False) -> bool: ...
    def symmetrize1(self, alignment_filename: str, output_filename: str, transpose: bool = False) -> bool: ...
    def symmetrize2(self, alignment_filename: str, output_filename: str, transpose: bool = False) -> bool: ...
    def close(self) -> None: ...

__all__ = [
    "AlignmentExtractor",
    "OnlineTrainingParameters",
    "PhraseExtractParameters",
    "PhraseModel",
    "SmtDecoder",
    "SmtModel",
    "TranslationData",
    "WordGraph",
    "WordGraphArc",
    "WordGraphState",
]
