diff --git a/systems/evaluate.py b/systems/evaluate.py
new file mode 100644
index 0000000..11ffd51
--- /dev/null
+++ b/systems/evaluate.py
@@ -0,0 +1,215 @@
+from lib.CoNLL_Annotation import *
+from collections import Counter, defaultdict
+import pandas as pd
+import numpy as np
+from sklearn.metrics import precision_recall_fscore_support as eval_f1
+from tabulate import tabulate
+import logging, argparse, sys
+from datetime import datetime
+
+
+tree_tagger_fixes = {
+    "die": "der", 
+    "eine": "ein", 
+    "dass": "daß", 
+    "keine": "kein",
+    "dies": "dieser",
+    "erst": "erster",
+    "andere": "anderer",
+    "alle": "aller",
+    "Sie": "sie",
+    "wir": "uns", 
+    "alle": "aller",
+    "wenige": "wenig"
+}
+
+
+def save_evaluated(all_sys, all_gld, out_path, print_gold=True):
+    with open(out_path, "w") as out:
+        if print_gold:
+            out.write(f"ORIGINAL_CORPUS_TAGS\n\nTAG\tGLD_COUNT\tSYS_COUNT\n")
+            for g_tag,g_count in sorted(all_gld.items()):
+                s_count = all_sys.get(g_tag, 0)
+                out.write(f"{g_tag}\t{g_count}\t{s_count}\n")
+        
+        out.write("\n\nSYSTEM_ONLY_TAGS\n\nTAG\tG_COUNT\tSYS_COUNT\n")
+        for s_tag,s_count in sorted(all_sys.items()):
+            g_count = all_gld.get(s_tag, 0)
+            if g_count == 0:
+                out.write(f"{s_tag}\t{g_count}\t{s_count}\n")
+    
+
+
+def eval_lemma(sys, gld):
+    match, err, symbol = 0, 0, []
+    y_gld, y_pred, mistakes = [], [], []
+    for i, gld_tok in enumerate(gld.tokens):
+        # sys_lemma = tree_tagger_fixes.get(sys.tokens[i].lemma, sys.tokens[i].lemma)  # Omit TreeTagger "errors" because of article lemma disagreement 
+        sys_lemma = sys.tokens[i].lemma
+        y_gld.append(gld_tok.pos_tag)
+        y_pred.append(sys_lemma)
+        if gld_tok.lemma == sys_lemma:
+            match += 1
+        elif not sys.tokens[i].lemma.isalnum(): # Turku does not lemmatize symbols (it only copies them) => ERR ((',', '--', ','), 43642)
+            symbol.append(sys.tokens[i].lemma)
+            if sys.tokens[i].word == sys.tokens[i].lemma:
+                match += 1
+            else:
+                err += 1
+        else:
+            err += 1
+            mistakes.append((gld_tok.word, gld_tok.lemma, sys.tokens[i].lemma))
+    return y_gld, y_pred, match, err, symbol, mistakes
+    
+
+def eval_pos(sys, gld):
+    match, mistakes = 0, []
+    y_gld, y_pred = [], []
+    for i, gld_tok in enumerate(gld.tokens):
+        y_gld.append(gld_tok.pos_tag)
+        y_pred.append(sys.tokens[i].pos_tag)
+        # pos_all_pred[gld_tok.pos_tag] += 1
+        # pos_all_gold[sys.tokens[i].pos_tag] += 1
+        if gld_tok.pos_tag == sys.tokens[i].pos_tag:
+            match += 1
+        elif gld_tok.pos_tag == "$." and sys.tokens[i].pos_tag == "$":
+            match += 1
+            y_pred = y_pred[:-1] + ["$."]
+        else:
+            mistakes.append((gld_tok.word, gld_tok.pos_tag, sys.tokens[i].pos_tag))
+    return y_gld, y_pred, match, mistakes
+
+
+
+if __name__ == "__main__":
+    """
+        EVALUATIONS: 
+        
+        ********** TIGER CORPUS ALL ************
+        
+            python systems/evaluate.py -t Turku --corpus_name Tiger\
+                --sys_file /home/daza/datasets/TIGER_conll/tiger_turku_parsed.conllu \
+                --gld_file /home/daza/datasets/TIGER_conll/tiger_release_aug07.corrected.16012013.conll09
+                
+            python systems/evaluate.py -t SpaCy --corpus_name Tiger\
+                --sys_file /home/daza/datasets/TIGER_conll/tiger_spacy_parsed.conllu \
+                --gld_file /home/daza/datasets/TIGER_conll/tiger_release_aug07.corrected.16012013.conll09
+                
+            python systems/evaluate.py -t RNNTagger --corpus_name Tiger\
+                --sys_file /home/daza/datasets/TIGER_conll/tiger_all.parsed.RNNTagger.conll \
+                --gld_file /home/daza/datasets/TIGER_conll/tiger_release_aug07.corrected.16012013.conll09
+            
+            python systems/evaluate.py -t TreeTagger --corpus_name Tiger\
+                --sys_file /home/daza/datasets/TIGER_conll/tiger_all.parsed.TreeTagger.conll \
+                --gld_file /home/daza/datasets/TIGER_conll/tiger_release_aug07.corrected.16012013.conll09
+            
+        ********** UNIVERSAL DEPENDENCIES TEST-SET ************
+
+            python systems/evaluate.py -t Turku --gld_token_type CoNLLUP_Token --corpus_name DE_GSD\
+            --sys_file /home/daza/datasets/ud-treebanks-v2.2/UD_German-GSD/de_gsd-ud-test.conllu.parsed.0.conllu \
+            --gld_file /home/daza/datasets/ud-treebanks-v2.2/UD_German-GSD/de_gsd-ud-test.conllu    
+            
+            python systems/evaluate.py -t SpaCyGL --gld_token_type CoNLLUP_Token --corpus_name DE_GSD\
+                --sys_file /home/daza/datasets/ud-treebanks-v2.2/UD_German-GSD/de_gsd-ud-test.parsed.germalemma.conllu \
+                --gld_file /home/daza/datasets/ud-treebanks-v2.2/UD_German-GSD/de_gsd-ud-test.conllu    
+            
+            python systems/evaluate.py -t SpaCy --gld_token_type CoNLLUP_Token --corpus_name DE_GSD\
+                --sys_file /home/daza/datasets/ud-treebanks-v2.2/UD_German-GSD/de_gsd-ud-test.parsed.conllu \
+                --gld_file /home/daza/datasets/ud-treebanks-v2.2/UD_German-GSD/de_gsd-ud-test.conllu 
+                
+            python systems/evaluate.py -t RNNTagger --gld_token_type CoNLLUP_Token --corpus_name DE_GSD\
+                --sys_file /home/daza/datasets/ud-treebanks-v2.2/UD_German-GSD/de_gsd-ud-test.RNNtagger.parsed.conll \
+                --gld_file /home/daza/datasets/ud-treebanks-v2.2/UD_German-GSD/de_gsd-ud-test.conllu
+            
+            python systems/evaluate.py -t TreeTagger --gld_token_type CoNLLUP_Token --corpus_name DE_GSD\
+                --sys_file /home/daza/datasets/ud-treebanks-v2.2/UD_German-GSD/de_gsd-ud-test.treetagger.parsed.conll \
+                --gld_file /home/daza/datasets/ud-treebanks-v2.2/UD_German-GSD/de_gsd-ud-test.conllu
+                
+    """
+    
+    # =====================================================================================
+    #                    INPUT PARAMS 
+    # =====================================================================================
+    parser = argparse.ArgumentParser()
+    parser.add_argument("-s", "--sys_file", help="System output in CoNLL-U Format", required=True)
+    parser.add_argument("-g", "--gld_file", help="Gold Labels to evaluate in CoNLL-U Format", required=True)
+    parser.add_argument("-t", "--type_sys", help="Which system produced the outputs", default="system")
+    parser.add_argument("-c", "--corpus_name", help="Corpus Name for Gold Labels", required=True)
+    parser.add_argument("-gtt", "--gld_token_type", help="CoNLL Format of the Gold Data", default="CoNLL09_Token")
+    parser.add_argument("-cs", "--comment_str", help="CoNLL Format of comentaries inside the file", default="#")
+    args = parser.parse_args()
+    
+    # =====================================================================================
+    #                    LOGGING INFO ...
+    # =====================================================================================
+    logger = logging.getLogger(__name__)
+    console_hdlr = logging.StreamHandler(sys.stdout)
+    file_hdlr = logging.FileHandler(filename=f"logs/Eval_{args.corpus_name}.{args.type_sys}.log")
+    logging.basicConfig(level=logging.INFO, handlers=[console_hdlr, file_hdlr])
+    now_is = datetime.now().strftime('%Y-%m-%d %H:%M:%S')
+    logger.info(f"\n\nEvaluating {args.corpus_name} Corpus {now_is}")
+
+    # Read the Original GOLD Annotations [CoNLL09, CoNLLUP]
+    gld_generator = read_conll_generator(args.gld_file, token_class=get_token_type(args.gld_token_type), comment_str=args.comment_str)
+    # Read the Annotations Generated by the Automatic Parser [Turku, SpaCy, RNNTagger] 
+    if args.type_sys == "RNNTagger":
+        sys_generator = read_conll_generator(args.sys_file, token_class=RNNTagger_Token, comment_str="#")
+    elif args.type_sys == "TreeTagger":
+        sys_generator = read_conll_generator(args.sys_file, token_class=RNNTagger_Token, sent_sep="</S>", comment_str="#")
+    else:
+        sys_generator = read_conll_generator(args.sys_file, token_class=CoNLLUP_Token, comment_str="#")
+    
+    lemma_all_match, lemma_all_err, lemma_all_mistakes = 0, 0, []
+    lemma_all_symbols, sys_only_lemmas = [], []
+    pos_all_match, pos_all_err, pos_all_mistakes = 0, 0, []
+    pos_all_pred, pos_all_gld = [], []
+    lemma_all_pred, lemma_all_gld = [], []
+    n_sents = 0
+    
+    for i, (s,g) in enumerate(zip(sys_generator, gld_generator)):
+        # print([x.word for x in s.tokens])
+        # print([x.word for x in g.tokens])
+        assert len(s.tokens) == len(g.tokens), f"Token Mismatch! S={len(s.tokens)} G={len(g.tokens)} IX={i+1}"
+        n_sents += 1
+        # Lemmas ...
+        lemma_gld, lemma_pred, lemma_match, lemma_err, lemma_sym, mistakes = eval_lemma(s,g)
+        lemma_all_match += lemma_match
+        lemma_all_err += lemma_err
+        lemma_all_mistakes += mistakes
+        lemma_all_symbols += lemma_sym
+        lemma_all_pred += lemma_pred
+        lemma_all_gld += lemma_gld
+        # POS Tags ...
+        pos_gld, pos_pred, pos_match, pos_mistakes = eval_pos(s, g)
+        pos_all_pred += pos_pred 
+        pos_all_gld += pos_gld
+        pos_all_match +=  pos_match
+        pos_all_err += len(pos_mistakes)
+        pos_all_mistakes += pos_mistakes
+    
+    logger.info(f"A total of {n_sents} sentences were analyzed")
+    
+    # Lemmas ...
+    logger.info(f"Lemma Matches = {lemma_all_match} || Errors = {lemma_all_err} || Symbol Chars = {len(lemma_all_symbols)}")
+    logger.info(f"Lemma Accuracy = {(lemma_all_match*100/(lemma_all_match + lemma_all_err)):.2f}%\n")
+    lemma_miss_df = pd.DataFrame(lemma_all_mistakes, columns =['Gold_Word', 'Gold_Lemma', 'Sys_Lemma']).value_counts()
+    lemma_miss_df.to_csv(path_or_buf=f"outputs/LemmaErrors.{args.corpus_name}.{args.type_sys}.tsv", sep="\t")
+    save_evaluated(Counter(lemma_all_pred), Counter(lemma_all_gld), 
+                            f"outputs/Lemma-Catalogue.{args.corpus_name}.{args.type_sys}.txt", print_gold=False)
+    
+    # POS Tags ...
+    logger.info(f"POS Matches = {pos_all_match} || Errors = {pos_all_err}")
+    logger.info(f"POS Tagging Accuracy = {(pos_all_match*100/(pos_all_match + pos_all_err)):.2f}%\n")
+    pos_miss_df = pd.DataFrame(pos_all_mistakes, columns =['Gold_Word', 'Gold_POS', 'Sys_POS']).value_counts()
+    pos_miss_df.to_csv(path_or_buf=f"outputs/POS-Errors.{args.corpus_name}.{args.type_sys}.tsv", sep="\t")
+    save_evaluated(Counter(pos_all_pred), Counter(pos_all_gld), f"outputs/POS-Catalogue.{args.corpus_name}.{args.type_sys}.txt")
+    
+    ordered_labels = sorted(set(pos_all_gld))
+    p_labels, r_labels, f_labels, support = eval_f1(y_true=pos_all_gld, y_pred=pos_all_pred, labels=ordered_labels , average=None)
+    scores_per_label = zip(ordered_labels, [x*100 for x in p_labels], [x*100 for x in r_labels], [x*100 for x in f_labels])
+    logger.info("\n\n")
+    logger.info(tabulate(scores_per_label, headers=["POS Tag","Precision", "Recall", "F1"], floatfmt=".2f"))
+    p_labels, r_labels, f_labels, support = eval_f1(y_true=np.array(pos_all_gld), y_pred=np.array(pos_all_pred), average='macro', zero_division=0)
+    logger.info(f"Total Prec = {p_labels*100}\tRec = {r_labels*100}\tF1 = {f_labels*100}")
+    
+    
\ No newline at end of file
