ModErn Text Analysis
META Enumerates Textual Applications
Namespaces | Functions
mapping.h File Reference
#include <fstream>
#include <string>
#include <vector>
#include "meta/config.h"
#include "meta/util/invertible_map.h"

Go to the source code of this file.

Namespaces

 meta
 The ModErn Text Analysis toolkit is a suite of natural language processing, classification, information retrieval, data mining, and other applications of text processing.
 

Functions

template<class Key , class Value , class... Args, template< class, class, class... > class Map>
Value meta::map::safe_at (const Map< Key, Value, Args... > &map, const Key &key)
 This safe_at allows the use of a hash function to be specified. More...
 
template<class Key , class Value >
void meta::map::save_mapping (const util::invertible_map< Key, Value > &map, const std::string &filename)
 Saves any arbitrary mapping to the disk. More...
 
template<class T >
void meta::map::save_mapping (const std::vector< T > &vec, const std::string &filename)
 Vector-specific version of save_mapping: saves any arbitrary mapping to the disk. More...
 
template<class Key , class Value >
void meta::map::load_mapping (util::invertible_map< Key, Value > &map, const std::string &filename)
 
template<class T >
void meta::map::load_mapping (std::vector< T > &vec, const std::string &filename)
 Vector-specific version of load_mapping. More...
 

Detailed Description

Author
Sean Massung

All files in META are dual-licensed under the MIT and NCSA licenses. For more details, consult the file LICENSE.mit and LICENSE.ncsa in the root of the project.

Function Documentation

§ safe_at()

template<class Key , class Value , class... Args, template< class, class, class... > class Map>
Value meta::map::safe_at ( const Map< Key, Value, Args... > &  map,
const Key &  key 
)

This safe_at allows the use of a hash function to be specified.

Parameters
mapThe map to search
keyThe key in the map to search for
Returns
the value for a given key in map if it exists; otherwise, the default Value() is returned.

§ save_mapping() [1/2]

template<class Key , class Value >
void meta::map::save_mapping ( const util::invertible_map< Key, Value > &  map,
const std::string &  filename 
)

Saves any arbitrary mapping to the disk.

Parameters
mapThe map to read key, value pairs from
filenameThe name to save the mapping as

§ save_mapping() [2/2]

template<class T >
void meta::map::save_mapping ( const std::vector< T > &  vec,
const std::string &  filename 
)

Vector-specific version of save_mapping: saves any arbitrary mapping to the disk.

Parameters
mapThe map to read key, value pairs from
filenameThe name to save the mapping as

§ load_mapping() [1/2]

template<class Key , class Value >
void meta::map::load_mapping ( util::invertible_map< Key, Value > &  map,
const std::string &  filename 
)
Parameters
mapThe map to load information into
filenameThe file containing key, value pairs

§ load_mapping() [2/2]

template<class T >
void meta::map::load_mapping ( std::vector< T > &  vec,
const std::string &  filename 
)

Vector-specific version of load_mapping.

Parameters
vecThe vector to load information into
filenameThe file containing the vector's data.