/*
    Copyright (C) 2012 Bartosz Broda, Jacek Bochenek, Łukasz Biłeńkij, 
    Damian Jaworski, Wojciech Mazur, Dominik Piasecki, Maciej Piasecki, 
    Radosław Ramocki
    
    This program is free software; you can redistribute it and/or modify it
under the terms of the GNU Lesser General Public License as published by the Free
Software Foundation; either version 3 of the License, or (at your option)
any later version.

    This program is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
or FITNESS FOR A PARTICULAR PURPOSE. 

    See the LICENSE and COPYING files for more details.
*/

#ifndef DICTIONARY_H
#define DICTIONARY_H
#include "Config.h"
#include <poliqarp_reader/PoliqarpReader.h>
#include <poliqarp_reader/PoliqarpSentencer.h>
#include <boost/unordered_map.hpp>


typedef boost::unordered_map<int, size_t> udict_inner_map;
typedef boost::unordered_map< Corpus::TFlexClass, udict_inner_map > udict_map;

/**
  * Main function for extracting dictionary from corpus
  */
void onlyMasterDict();
/**
  * Function writing lexems to file
  * \param conf Configuration read from input file
  * \param base_udict Unigram dictionary for each flex class specified in config
  */
void write_orths(me_architect::Config &conf, std::map<int, size_t> &orth_udict);
/**
  * Function returning most important disamb from token
  * \param pToken Token for disamb extraction
  * \returns Most important disamb
  */
Corpus::CLexem *get_disamb(Corpus::CToken *pToken, me_architect::Config &conf);
/**
  Adds token's base to dictionary
  * \param pToken Token with base to be inserted
  * \param base_udict Unigram dictionary storing frequency of each base lexem
  * \param conf Configuration read from input file
  */
void add_base(Corpus::CToken *pToken, udict_map &base_udict, me_architect::Config &conf);

/**
  * Function processing single corpus and making dictionary out of it
  * \param corpNo Number of corpus from all corpuses in input file
  * \param base_udict Output dictionary to be filled
  */
void singleCorpusDict(int corpNo,udict_map &base_udict);

/**
  * Function writing word bases to a file
  * \param conf Instance of Config
  * \param base_udict Dictionary with bases to be written
  */
void write_bases(me_architect::Config &conf, udict_map &base_udict);

std::vector<char> loadCharStoplist();


#endif // DICTIONARY_H
