#!/usr/bin/env python3
# -*- coding: utf-8 -*-

import collections
import re


class VocabSymbols():
    # Syntactic model
    PAD_SYN = '<pad>'
    UNK_SYN = '<unk>'
    BOS_SYN = '<bos>'
    EOS_SYN = '<eos>'

    # Morph symbols
    PAD_MORPH = '%'
    UNK_MORPH = '#'
    BOS_MORPH = '<'
    EOS_MORPH = '>'
    STEP_MORPH = '^'
    ALIGN_MORPH = '~'

    # BinLin decision (binary tree traversal)
    LEFT = 0
    RIGHT = 1

    SYN_START_VOCAB_MLP = [PAD_SYN, UNK_SYN]
    MORPH_START_VOCAB = [PAD_MORPH, UNK_MORPH, BOS_MORPH, EOS_MORPH, STEP_MORPH, ALIGN_MORPH]
    MORPH_START_VOCAB_SET = set(MORPH_START_VOCAB)


class Regex():
    SR_SNT_COMMENT_PAT = re.compile('(# text = )(.*)')


class Latex():
    # Courtesy to MB
    latex_bt_single = r"""\documentclass{{standalone}}
            \usepackage{{tikz}}
            \usepackage{{tikz-qtree}}
    
            \makeatletter 
            \let\old@@children\@@children
            \def\@@children{{\futurelet\my@next\my@@children}}
            \def\my@@children{{%
            \ifx\my@next\missing\else
            \expandafter\@gobble
            \fi
            \expandafter\old@@children}}    
            \makeatother
            \newcommand{{\missing}}{{ \edge[draw=none]; {{}} }}
    
            \begin{{document}}
                \begin{{tikzpicture}}[level distance=2cm, every tree node/.style={{align=center,text width=2.5cm,anchor=north}}]
                    \Tree {tree}
               \end{{tikzpicture}}
            \end{{document}}
            """

    latex_bt_pair = r"""\documentclass[preview]{{standalone}}
            \usepackage{{tikz}}
            \usepackage{{tikz-qtree}}
            \usepackage{{graphicx,adjustbox}}
            
            \makeatletter 
            \let\old@@children\@@children
            \def\@@children{{\futurelet\my@next\my@@children}}
            \def\my@@children{{%
            \ifx\my@next\missing\else
            \expandafter\@gobble
            \fi
            \expandafter\old@@children}}    
            \makeatother
            \newcommand{{\missing}}{{ \edge[draw=none]; {{}} }}
    
            \begin{{document}}
            
                \begin{{figure}}
                \centering 
                \begin{{adjustbox}}{{max width=0.5\textwidth}}                
                \begin{{tikzpicture}}[level distance=2cm, every tree node/.style={{align=center,text width=2.5cm,anchor=north}}]
                    \Tree {tree1}
                \end{{tikzpicture}}
                \end{{adjustbox}}
                \caption{{ {tree1caption} }}
                \end{{figure}}
                %
                \begin{{figure}}
                \centering
                 \begin{{adjustbox}}{{max width=0.5\textwidth}}
                    \begin{{tikzpicture}}[level distance=2cm, every tree node/.style={{align=center,text width=2.5cm,anchor=north}}]
                        \Tree {tree2}
                    \end{{tikzpicture}}
                \end{{adjustbox}}
                \caption{{ {tree2caption} }}
                \end{{figure}}
                   
            \end{{document}}
            """


# Named tuples
Token = collections.namedtuple('Token', ['GOLD_ID', 'GOLD_FORM', 'LEMMA', 'UPOS', 'XPOS',
                                         'FEATS', 'HEAD', 'DEPREL', 'DEPS', 'MISC'])

#!/usr/bin/env python3
# -*- coding: utf-8 -*-

import collections
import re


class VocabSymbols():
    # Syntactic model
    PAD_SYN = '<pad>'
    UNK_SYN = '<unk>'
    BOS_SYN = '<bos>'
    EOS_SYN = '<eos>'

    # Morph symbols
    PAD_MORPH = '%'
    UNK_MORPH = '#'
    BOS_MORPH = '<'
    EOS_MORPH = '>'
    STEP_MORPH = '^'
    ALIGN_MORPH = '~'

    # BinLin decision (binary tree traversal)
    LEFT = 0
    RIGHT = 1

    SYN_START_VOCAB_MLP = [PAD_SYN, UNK_SYN]
    MORPH_START_VOCAB = [PAD_MORPH, UNK_MORPH, BOS_MORPH, EOS_MORPH, STEP_MORPH, ALIGN_MORPH]
    MORPH_START_VOCAB_SET = set(MORPH_START_VOCAB)


class Regex():
    SR_SNT_COMMENT_PAT = re.compile('(# text = )(.*)')


class Latex():
    # Courtesy to MB
    latex_bt_single = r"""\documentclass{{standalone}}
            \usepackage{{tikz}}
            \usepackage{{tikz-qtree}}
    
            \makeatletter 
            \let\old@@children\@@children
            \def\@@children{{\futurelet\my@next\my@@children}}
            \def\my@@children{{%
            \ifx\my@next\missing\else
            \expandafter\@gobble
            \fi
            \expandafter\old@@children}}    
            \makeatother
            \newcommand{{\missing}}{{ \edge[draw=none]; {{}} }}
    
            \begin{{document}}
                \begin{{tikzpicture}}[level distance=2cm, every tree node/.style={{align=center,text width=2.5cm,anchor=north}}]
                    \Tree {tree}
               \end{{tikzpicture}}
            \end{{document}}
            """

    latex_bt_pair = r"""\documentclass[preview]{{standalone}}
            \usepackage{{tikz}}
            \usepackage{{tikz-qtree}}
            \usepackage{{graphicx,adjustbox}}
            
            \makeatletter 
            \let\old@@children\@@children
            \def\@@children{{\futurelet\my@next\my@@children}}
            \def\my@@children{{%
            \ifx\my@next\missing\else
            \expandafter\@gobble
            \fi
            \expandafter\old@@children}}    
            \makeatother
            \newcommand{{\missing}}{{ \edge[draw=none]; {{}} }}
    
            \begin{{document}}
            
                \begin{{figure}}
                \centering 
                \begin{{adjustbox}}{{max width=0.5\textwidth}}                
                \begin{{tikzpicture}}[level distance=2cm, every tree node/.style={{align=center,text width=2.5cm,anchor=north}}]
                    \Tree {tree1}
                \end{{tikzpicture}}
                \end{{adjustbox}}
                \caption{{ {tree1caption} }}
                \end{{figure}}
                %
                \begin{{figure}}
                \centering
                 \begin{{adjustbox}}{{max width=0.5\textwidth}}
                    \begin{{tikzpicture}}[level distance=2cm, every tree node/.style={{align=center,text width=2.5cm,anchor=north}}]
                        \Tree {tree2}
                    \end{{tikzpicture}}
                \end{{adjustbox}}
                \caption{{ {tree2caption} }}
                \end{{figure}}
                   
            \end{{document}}
            """


# Named tuples
Token = collections.namedtuple('Token', ['GOLD_ID', 'GOLD_FORM', 'LEMMA', 'UPOS', 'XPOS',
                                         'FEATS', 'HEAD', 'DEPREL', 'DEPS', 'MISC'])

#!/usr/bin/env python3 # -*- coding: utf-8 -*- # Syntactic model # Morph symbols # BinLin decision (binary tree traversal) # text = )(.*)') # Courtesy to MB \documentclass{{standalone}}             \usepackage{{tikz}}             \usepackage{{tikz-qtree}}                  \makeatletter              \let\old@@children\@@children             \def\@@children{{\futurelet\my@next\my@@children}}             \def\my@@children{{%             \ifx\my@next\missing\else             \expandafter\@gobble             \fi             \expandafter\old@@children}}                 \makeatother             \newcommand{{\missing}}{{ \edge[draw=none]; {{}} }}                  \begin{{document}}                 \begin{{tikzpicture}}[level distance=2cm, every tree node/.style={{align=center,text width=2.5cm,anchor=north}}]                     \Tree {tree}                \end{{tikzpicture}}             \end{{document}} \documentclass[preview]{{standalone}}             \usepackage{{tikz}}             \usepackage{{tikz-qtree}}             \usepackage{{graphicx,adjustbox}}                          \makeatletter              \let\old@@children\@@children             \def\@@children{{\futurelet\my@next\my@@children}}             \def\my@@children{{%             \ifx\my@next\missing\else             \expandafter\@gobble             \fi             \expandafter\old@@children}}                 \makeatother             \newcommand{{\missing}}{{ \edge[draw=none]; {{}} }}                  \begin{{document}}                              \begin{{figure}}                 \centering                  \begin{{adjustbox}}{{max width=0.5\textwidth}}                                 \begin{{tikzpicture}}[level distance=2cm, every tree node/.style={{align=center,text width=2.5cm,anchor=north}}]                     \Tree {tree1}                 \end{{tikzpicture}}                 \end{{adjustbox}}                 \caption{{ {tree1caption} }}                 \end{{figure}}                 %                 \begin{{figure}}                 \centering                  \begin{{adjustbox}}{{max width=0.5\textwidth}}                     \begin{{tikzpicture}}[level distance=2cm, every tree node/.style={{align=center,text width=2.5cm,anchor=north}}]                         \Tree {tree2}                     \end{{tikzpicture}}                 \end{{adjustbox}}                 \caption{{ {tree2caption} }}                 \end{{figure}}                                 \end{{document}} # Named tuples